Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Field type file not available in sandbox #626

Closed
danbelden opened this issue May 22, 2015 · 5 comments
Closed

Field type file not available in sandbox #626

danbelden opened this issue May 22, 2015 · 5 comments

Comments

@danbelden
Copy link

I have configured the form field type "file" on an endpoint:

parameters={
     *         {
     *          "name"="image",
     *          "dataType"="file",
     *          "required"="true",
     *          "description"="Label image data"
     *         },
     *         {
     *          "name"="brand",
     *          "dataType"="string",
     *          "required"="true",
     *          "description"="Label brand name"
     *         }
     *     },

Which seems to work fine in the web input view:

api_documentation

However upon selecting an image and submitting there is nothing registered in the Symfony files bucket:

var_dump($request->files->count());
exit;

api_documentation

We have tested the controller/action using the following more simplistic upload code and the endpoint works perfectly, however with sandbox, we hit one of our no file HTTP exception throws:

<!DOCTYPE html>
<html>
<body>
<form action="<?php echo $view['router']->generate('X') ?>" method="post" enctype="multipart/form-data">
    Select image to upload:
    <input type="file" name="image" id="image">
    Brand:
    <input type="text" name="brand" id="brand">
    <input type="submit" value="Upload Image" name="submit">
</form>
</body>
</html>

Looking at the request headers supplied by sandbox to the endpoint:

Host: X
Connection: keep-alive
Content-Length: 1372423
Accept: */*
Origin: http://shareight-ocr-api.local
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.65 Safari/537.36
Content-type: application/x-www-form-urlencoded
Referer: Y
Accept-Encoding: gzip, deflate
Accept-Language: en-US,en;q=0.8
Cookie: PHPSESSID=3e86aq8grvhpr0f65bbpk5t026

As opposed to the request headers supplied by our test view:

Host: X
Connection: keep-alive
Content-Length: 388
Cache-Control: max-age=0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Origin: http://shareight-ocr-api.local
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.65 Safari/537.36
Content-Type: multipart/form-data; boundary=----WebKitFormBoundarybQ2AVw3HT0PvIVrT
Referer: Z
Accept-Encoding: gzip, deflate
Accept-Language: en-US,en;q=0.8
Cookie: PHPSESSID=3e86aq8grvhpr0f65bbpk5t026

We notice the following differences:

[Bad -Sandbox] Content-type: application/x-www-form-urlencoded
[Good - Webview] Content-Type: multipart/form-data; boundary=----WebKitFormBoundarybQ2AVw3HT0PvIVrT

I noticed the following bug report here: #501

  • It's marked closed but this issue remains in v2.9?
  • Just an FYI.
@jibay
Copy link

jibay commented Jun 4, 2015

+1

3 similar comments
@Wirone
Copy link

Wirone commented Jun 9, 2015

+1

@foaly-nr1
Copy link

+1

@almasry
Copy link

almasry commented May 28, 2017

+1

@dbu
Copy link
Collaborator

dbu commented Dec 22, 2017

version 3 is a complete rewrite. please check if this is still a problem with version 3 and a recent symfony version.

@dbu dbu closed this as completed Dec 22, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants