Skip to content Skip to sidebar Skip to footer

Drag-and-drop Image Upload Not Working On Server

I am trying to implement a drag-and-drop image upload. I found a rather simple script online and adapted to my use. On my local installation the file uploads perfectly fine, but no

Solution 1:

You probably will have solved your problem now, but I'm posting this solution here to help others who come here with the same problem. In your js, there is a line that reads

 xhr.setRequestHeader("X_FILENAME", file.name);

but should read

 xhr.setRequestHeader("X-FILENAME", file.name);

since underscores are deprecated in later Apache releases (see also Header names with underscores ignored in php 5.5.1 / apache 2.4.6)


Solution 2:

I had this problem on one of my Ubuntu WAMP installations. Your upload URL (the POST URL specified on the Javascript side of things) needs to be a fully qualified path not a relative path. I can't see the value however but seems to be the value of whatever $id("upload").action is in your code. You can confirm this is the cause by looking at the apache logs if you have access to them. If you see 404 errors when trying to send a file then this is your problem. Thats assuming the request even hits your server at all.


Post a Comment for "Drag-and-drop Image Upload Not Working On Server"