Problem with FileUpload with jQuery-File-Upload

875 views
Skip to first unread message

Samuel Lörtscher

unread,
Jan 29, 2013, 6:23:01 AM1/29/13
to play-fr...@googlegroups.com
Hi guys
I have a serious problem with uploading files using the jQuery-File-Upload (https://github.com/blueimp/jQuery-File-Upload).
For some reasons, my Controller Method is never going to be called, instead I get a Action Not Found Response.
Normal File Upload using multipart/form-data on the other hand, works perfect. Those a are the RAW Request and Partial Responses captured
using an intercepting proxy:

I can hardly see any difference (there are differences but those are of very minor nature in my opinion)...

Do you guys have any idea, any help would be greatly appreciated :-)

Best regards
Samuel

Conventional multipart/form-data
######################################################
Request
****************************************************************************
POST /media/upload HTTP/1.1

Host: localhost:8080
Connection: keep-alive
Content-Length: 685
Cache-Control: max-age=0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Origin: http://localhost:8080
User-Agent: Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.56 Safari/537.17
Content-Type: multipart/form-data; boundary=----WebKitFormBoundarykAmdZenxGi9IQoIj
Referer: http://localhost:8080/media/new
Accept-Encoding: gzip,deflate,sdch
Accept-Language: de-DE,de;q=0.8,en-US;q=0.6,en;q=0.4
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
Cookie: PLAY_SESSION=6f7e8949f37f520d1de2b6135cc7485be3bbaa74-ProfileID%3A1


------WebKitFormBoundarykAmdZenxGi9IQoIj
Content-Disposition: form-data; name="media-caption"




------WebKitFormBoundarykAmdZenxGi9IQoIj
Content-Disposition: form-data; name="media-description"




------WebKitFormBoundarykAmdZenxGi9IQoIj
Content-Disposition: form-data; name="media-language"




------WebKitFormBoundarykAmdZenxGi9IQoIj
Content-Disposition: form-data; name="media-country"




------WebKitFormBoundarykAmdZenxGi9IQoIj
Content-Disposition: form-data; name="media-city"




------WebKitFormBoundarykAmdZenxGi9IQoIj
Content-Disposition: form-data; name="cover"; filename="a.txt"
Content-Type: text/plain


WTF
------WebKitFormBoundarykAmdZenxGi9IQoIj--


Response
****************************************************************************
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Content-Length: 30


{"files":[{"name":"Hua.jpg"}]}




######################################################
Request
****************************************************************************
POST /media/upload/ HTTP/1.1
Host: localhost:8080
Connection: keep-alive
Content-Length: 685
Accept: text/html, */*; q=0.01
X-Requested-With: XMLHttpRequest
User-Agent: Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.56 Safari/537.17
Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryxguCvmWrHSOmhlIX
Accept-Encoding: gzip,deflate,sdch
Accept-Language: de-DE,de;q=0.8,en-US;q=0.6,en;q=0.4
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
Cookie: PLAY_SESSION=6f7e8949f37f520d1de2b6135cc7485be3bbaa74-ProfileID%3A1

------WebKitFormBoundaryxguCvmWrHSOmhlIX
Content-Disposition: form-data; name="media-caption"


------WebKitFormBoundaryxguCvmWrHSOmhlIX
Content-Disposition: form-data; name="media-description"


------WebKitFormBoundaryxguCvmWrHSOmhlIX
Content-Disposition: form-data; name="media-language"


------WebKitFormBoundaryxguCvmWrHSOmhlIX
Content-Disposition: form-data; name="media-country"


------WebKitFormBoundaryxguCvmWrHSOmhlIX
Content-Disposition: form-data; name="media-city"


------WebKitFormBoundaryxguCvmWrHSOmhlIX
Content-Disposition: form-data; name="cover"; filename="a.txt"
Content-Type: text/plain

WTF
------WebKitFormBoundaryxguCvmWrHSOmhlIX--



Response
****************************************************************************
HTTP/1.1 404 Not Found
Content-Type: text/html; charset=utf-8
Content-Length: 9730



<!DOCTYPE html>
<html>
<head>
<title>Action not found</title>

Brian Smith

unread,
Jan 29, 2013, 6:27:53 AM1/29/13
to play-fr...@googlegroups.com
A quick guess without checking - trailing / on the URL?

Samuel Lörtscher

unread,
Jan 29, 2013, 7:19:17 AM1/29/13
to play-fr...@googlegroups.com
@Brian Smith
It's ridiculous how could I overlook that obvious error! :-/
It works fine now, many thanks :-)

@admins, I think we can delete this post as it is not gonna be a help to anybody.
Message has been deleted

Samuel Lörtscher

unread,
Feb 1, 2013, 5:08:56 AM2/1/13
to play-fr...@googlegroups.com
Hi Alex
To be honest, I don't understand your question? What do you intend to use? The jQuery-File-Upload?
On the backend I store the uploaded file in a temporary file, then I have to create an flv,mp4 counterpart with http://ffmpeg.org/.
(If a user uploaded an mp4, I create an additional flv file or vice versa).
Then I upload both files to Amazon S3 Storage. For downloading am gonna use time constrained signed urls, so the player can download the movie file directly from S3.
(I actually have a fallback system using local files in very low quality, in case the costs are going to explode).

Or do you mean the problem of associating files to the main form data Post? For this I give any formular a particular unique ID. So when the user finally posts the main formular,
I know which files (asynchronically uploaded) belong to that formular (if its already uploaded).

Everything happens very asnychronically using AKKA. The current state of file processing is written to the database and a javascript regularly updates the status using AJAX and JSON.

Does this help you?

Am Freitag, 1. Februar 2013 10:14:10 UTC+1 schrieb Alex:
Hi Samuel

I was thinking about using this, but how do you process the information on the backend ?

Alex
Reply all
Reply to author
Forward
0 new messages