# Upload filename with double quote failure

**URL:** <https://www.ruby-forum.com/t/upload-filename-with-double-quote-failure/228495>\
**Category:** NGINX\
**Created:** [April 24, 2013, 5:08pm UTC](https://www.ruby-forum.com/t/upload-filename-with-double-quote-failure/228495 "2013-04-24T17:08:44Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![motto](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/aca169/32.png) [@motto](https://www.ruby-forum.com/u/motto)\
**Post date:** [April 24, 2013, 5:08pm UTC](https://www.ruby-forum.com/t/upload-filename-with-double-quote-failure/228495/1 "2013-04-24T17:08:44Z")

</div>

Problem uploading file name - test"try.txt (with double quotes inside  
file  
name) under firefox browser.  
It pass to backend file content as a file name.

{“note”: [“”], “upfile”:  
[“erthtyjt\nrthy\ntrh\nrt\nh\nrt\nh\nrt\nh\nrth\nr\nth\nr\nth\n\nt\n\n”]}

here is debug from nginx.  
[http://pastebin.com/P6nkNNj3](http://pastebin.com/P6nkNNj3)

Posted at Nginx Forum:

> **[upload filename with double quote failure](https://forum.nginx.org/read.php?2,238613,238613#msg-238613)**
>
> Problem uploading file name - test"try.txt (with double quotes inside file name) under firefox browser. It pass to backend file content as a file name. {"note": \[""\], "upfile":...

---

<div class="post-metadata">

**Author:** ![motto](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/aca169/32.png) [@motto](https://www.ruby-forum.com/u/motto)\
**Post date:** [April 24, 2013, 5:45pm UTC](https://www.ruby-forum.com/t/upload-filename-with-double-quote-failure/228495/2 "2013-04-24T17:45:32Z")

</div>

Hello!

On Wed, Apr 24, 2013 at 11:08:11AM -0400, motto wrote:

> Problem uploading file name - test"try.txt (with double quotes inside file  
> name) under firefox browser.  
> It pass to backend file content as a file name.
> 
> {“note”: [“”], “upfile”:  
> [“erthtyjt\nrthy\ntrh\nrt\nh\nrt\nh\nrt\nh\nrth\nr\nth\nr\nth\n\nt\n\n”]}
> 
> here is debug from nginx.  
> [http://pastebin.com/P6nkNNj3](http://pastebin.com/P6nkNNj3)

It doesn’t look like there is anything wrong in nginx. Try  
looking into what happens on your backend.

–  
Maxim D.

> **[nginx: donation](http://nginx.org/en/donation.html)**

---

<div class="post-metadata">

**Author:** ![motto](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/aca169/32.png) [@motto](https://www.ruby-forum.com/u/motto)\
**Post date:** [April 24, 2013, 5:57pm UTC](https://www.ruby-forum.com/t/upload-filename-with-double-quote-failure/228495/3 "2013-04-24T17:57:49Z")

</div>

as for nginx backend for debug purpose I use python-tornado script,  
which  
will just give back params, which nginx pass to it.  
so here it is:  
upload under Chrome:  
{u’upfile.path’: [‘/usr/local/apps/Opus/temp/upload/6/0009495446’],  
u’upfile.size’: [‘51’], u’upfile.name’: [‘test%22try.txt’], u’note’:  
[‘’],  
u’upfile.md5’: [‘5a089ad5ea93048b0d492d53626bf76b’],  
u’upfile.content\_type’:  
[‘text/plain’]}  
upload under Firefox:  
{u’note’: [‘’], u’upfile’:  
[‘erthtyjt\nrthy\ntrh\nrt\nh\nrt\nh\nrt\nh\nrth\nr\nth\nr\nth\n\nt\n\n’]}

Chrome does character encoding, but Firefox - just backspace double  
quote  
sign.

Posted at Nginx Forum:

> **[Re: upload filename with double quote failure](https://forum.nginx.org/read.php?2,238613,238618#msg-238618)**
>
> Problem uploading file name - test"try.txt (with double quotes inside file name) under firefox browser. It pass to backend file content as a file name. {"note": \[""\], "upfile":...

---

<div class="post-metadata">

**Author:** ![motto](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/aca169/32.png) [@motto](https://www.ruby-forum.com/u/motto)\
**Post date:** [April 24, 2013, 7:37pm UTC](https://www.ruby-forum.com/t/upload-filename-with-double-quote-failure/228495/4 "2013-04-24T19:37:08Z")

</div>

Hello!

On Wed, Apr 24, 2013 at 11:57:03AM -0400, motto wrote:

> [‘erthtyjt\nrthy\ntrh\nrt\nh\nrt\nh\nrt\nh\nrth\nr\nth\nr\nth\n\nt\n\n’]}
> 
> Chrome does character encoding, but Firefox - just backspace double quote  
> sign.

What Firefox does is actually correct per RFC, as handling of  
multipart/form-data forms should be done per MIME encoding rules.  
See [RFC 2388: Returning Values from Forms: multipart/form-data | RFC Editor](http://tools.ietf.org/html/rfc2388) for more details.

Though anyway it’s not related to nginx - it doesn’t do anything  
with a request body provided by a browser, it just passes it as is  
to a backend.

–  
Maxim D.

> **[nginx: donation](http://nginx.org/en/donation.html)**

---

<div class="post-metadata">

**Author:** ![motto](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/aca169/32.png) [@motto](https://www.ruby-forum.com/u/motto)\
**Post date:** [April 25, 2013, 12:43pm UTC](https://www.ruby-forum.com/t/upload-filename-with-double-quote-failure/228495/5 "2013-04-25T12:43:18Z")

</div>

Hello!

On Thu, Apr 25, 2013 at 03:06:36AM -0400, motto wrote:

> ```
> upload_set_form_field $upload_field_name.path "$upload_tmp_path";
> location @test {
> proxy_pass http://localhost:8080;
> }
> 
> ```
> 
> in case with firefox upload as you could see above, only “upfile” parameter  
> is available, while upfile.path, upfile.name and others are missing.  
> That could not be related to backend as I used the same backend while  
> uploading with the same form under Chrome and Firefox in above example.  
> Thank you.

Ah, ok, I understand now. You are using upload module by Valery  
Kholodkov ([http://grid.net.ru/nginx/upload.en.html](http://grid.net.ru/nginx/upload.en.html)). It indeed  
changes the request body and might introduce the problem.

You may want to make sure you are able to reproduce the problem  
with latest version of the upload module and report the problem to  
the module author.

–  
Maxim D.

> **[nginx: donation](http://nginx.org/en/donation.html)**

---

<div class="post-metadata">

**Author:** ![motto](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/aca169/32.png) [@motto](https://www.ruby-forum.com/u/motto)\
**Post date:** [April 25, 2013, 9:07am UTC](https://www.ruby-forum.com/t/upload-filename-with-double-quote-failure/228495/6 "2013-04-25T09:07:06Z")

</div>

Sorry to be annoying, here is part of nginx config:

```
 # Upload form should be submitted to this location
location /upload_test {
    upload_pass @test;
    upload_store /usr/local/apps/Opus/temp/upload 1;
    upload_store_access user:r;
    upload_set_form_field $upload_field_name.name 

```

“$upload\_file\_name”;  
upload\_set\_form\_field $upload\_field\_name.content\_type  
“$upload\_content\_type”;  
upload\_set\_form\_field $upload\_field\_name.path  
“$upload\_tmp\_path”;  
upload\_aggregate\_form\_field “$upload\_field\_name.md5”  
“$upload\_file\_md5”;  
upload\_aggregate\_form\_field “$upload\_field\_name.size”  
“$upload\_file\_size”;  
upload\_pass\_form\_field “^(.\*)”;  
#upload\_cleanup 400 404 499 500-505;  
upload\_cleanup 404;  
}

```
# Pass altered request body to a backend
location @test {
    proxy_pass http://localhost:8080;
}

```

in case with firefox upload as you could see above, only “upfile”  
parameter  
is available, while upfile.path, upfile.name and others are missing.  
That could not be related to backend as I used the same backend while  
uploading with the same form under Chrome and Firefox in above example.  
Thank you.

Posted at Nginx Forum:

> **[Re: upload filename with double quote failure](https://forum.nginx.org/read.php?2,238613,238627#msg-238627)**
>
> Problem uploading file name - test"try.txt (with double quotes inside file name) under firefox browser. It pass to backend file content as a file name. {"note": \[""\], "upfile":...
