-
celtsocAsked on February 1, 2016 at 4:19 PM
I'm using the feature where files are uploaded to my web server directly from a form submission and there seems to be a discrepancy in the filename created on the server versus what is passed to my php script from the form.
As an example, a submission included a file named "2014-11-07_Felton_Art_Walk1.jpg" and the file was uploaded to the directory and folder I specified with that name. However, the name that was passed to my php script was "2014-11-07+Felton+Art+Walk1.jpg" with the underscore characters replaced by "+".
I use the filename passed to my script to build a web page including a reference to the file on my server so in this case, the file was not found because of the differing filenames.
Any ideas why this might be happening?
Pete
-
jonathanReplied on February 1, 2016 at 10:52 PM
Hi Pete,
Can you clarify if the uploaded file was being renamed when it reaches the FTP server?
Or was it after your own PHP script have processed the file already...
I am not sure yet if you meant JotForm was the one changing the file or if it was your custom script.
From what I have checked on our FTP integration, it doesn't do any changes on the filename.
It will help if you can provide us also a means to test how your PHP script processed the file going to your web server directory.
We will check further once we understand more about the problem.
Thanks.
-
celtsocReplied on February 2, 2016 at 3:46 PMHere's what appears to have happened.
- User used a filename that included "+" characters, e.g. "My+image+file"
- The php S_POST variable for the file contained "My+image+file"
- After the file was ftp'd to my server, it's name was "My_image_file"
- When I look at the submission on jotform, the file is named
"My_image_file"
My php script does not change the filename it receives in the $_POST
variable in any way. It writes all the $_POST information to a mySQL
database and the entry for this submission had the "+" signs in the
filename.
It would appear that somewhere along the line, jotform changes the "+"
characters to "_".
Pete
... -
jonathanReplied on February 2, 2016 at 5:01 PM
Thank you for providing much details. Please allow me to investigate and do further test.
I'll get back to this shortly.
-
jonathanReplied on February 2, 2016 at 5:22 PM
I was able to reproduced the changed in the upload filename also.
You were right, even only on the Submission page, the filename was being changed already.
in View Submission page
In my test FTP directory
I have submitted a report to our higher team support. We will let you know at once for status update when available.
-
celtsocReplied on February 2, 2016 at 7:45 PMThanks for letting me know Jonathan, look forward to hearing the response.
I think I know what the problem is. The "+" sign in a URL is the
equivalent of a space character and I think your software is trying to the
filename ending up with spaces when ftp'd to a server. That's fine, just
need the ftp'd filename to be the same as the one passed to my php script
and also the one showed in the Submissions display.
Pete
... -
liyamReplied on February 3, 2016 at 8:19 PM
Hello,
The reason for this is because the + signs are treated differently on the web. + signs are equivalent to spaces in html characters. Therefore, it causes failures in accessing the said files when downloading it via browser. As a solution, + signs are converted to underscores.
-
celtsocReplied on February 3, 2016 at 9:16 PM
I understand that. But you need to be consistent. The "+" signs are converted to underscores for the purposes of ftp and storing the image on your server. But what is passed in the $_POST array to my php script still has the "+" characters. That means when I try to access the file on my server, the path to it is wrong. Or if I tried to access it on your server.
The string passed to my script should have the "+" signs replaced by the underscores before it is sent.
Pete
-
Welvin Support Team LeadReplied on February 4, 2016 at 4:42 AM
I have forwarded this to the assigned developer. For now, you can do a replace in your PHP script.
-
celtsocReplied on February 4, 2016 at 11:46 AMThanks. Will I be notified when this is fixed?
I'm aware of str_replace but are there any other characters that would
cause similar issues?
... -
victorReplied on February 4, 2016 at 1:14 PM
Yes, as soon as we have any update from your team. You will be immediately updated. I will also ask our team if there are any other characters that could be causing issues.
I personally would recommend not to use any special characters except underscore "_" in names. This could cause many issues not just with Jotform but other application as well.
-
liyamReplied on February 4, 2016 at 1:39 PM
Thanks for raising the concern, Pete. I have now fixed the problem. File name fixes on your received files should be the same now with the post data.
Warm regards.
-
celtsocReplied on February 4, 2016 at 2:45 PMGreat, thanks for the great customer service.
Pete
... -
victorReplied on February 4, 2016 at 4:50 PM
On behalf of the team, you are welcome. If you have any other question or issue, please do not hesitate asking. We will be glad to answer all your questions.