What is JotForm?
JotForm is a free online form builder which helps you create online forms without writing a single line of code. No sign-up required.

At JotForm, we want to make sure that you’re getting the online form builder help that you need. Our friendly customer support team is available 24/7.

We believe that if one user has a question, there could be more users who may have the same question. This is why many of our support forum threads are public and available to be searched and viewed. If you’d like help immediately, feel free to search for a similar question, or submit your question or concern.


  • Profile Image

    FTP filename discrepancy

    Asked by celtsoc on February 01, 2016 at 04: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

     

    FTP filename discrepancy uploads
  • Profile Image
    JotForm Support

    Answered by jonathan on February 01, 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.

     

  • Profile Image

    Answered by celtsoc on February 02, 2016 at 03:46 PM
    Here'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
    ...
  • Profile Image
    JotForm Support

    Answered by jonathan on February 02, 2016 at 05:01 PM

    Thank you for providing much details. Please allow me to investigate and do further test.

    I'll get back to this shortly.

  • Profile Image
    JotForm Support

    Answered by jonathan on February 02, 2016 at 05: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.

     

     

  • Profile Image

    Answered by celtsoc on February 02, 2016 at 07:45 PM
    Thanks 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
    ...
  • Profile Image
    JotForm Support

    Answered by liyam on February 03, 2016 at 08: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.

  • Profile Image

    Answered by celtsoc on February 03, 2016 at 09: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

  • Profile Image
    JotForm Support

    Answered by Welvin on February 04, 2016 at 04:42 AM

    I have forwarded this to the assigned developer. For now, you can do a replace in your PHP script.

    http://php.net/manual/en/function.str-replace.php 

  • Profile Image

    Answered by celtsoc on February 04, 2016 at 11:46 AM
    Thanks. 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?
    ...
  • Profile Image

    Answered by victor on February 04, 2016 at 01: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.

  • Profile Image
    JotForm Support

    Answered by liyam on February 04, 2016 at 01: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.

  • Profile Image

    Answered by celtsoc on February 04, 2016 at 02:45 PM
    Great, thanks for the great customer service.
    Pete
    ...
  • Profile Image

    Answered by victor on February 04, 2016 at 04: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.