Send Files through API: External file URLs are prepended with Jotform URL

  • Suporte_Freedom
    Perguntado em 28 de novembro de 2023 às 09:46

    Olá, bom dia.

    Estou tendo problemas para enviar uma imagem como anexo do meu formulário através do link:

    - https://api.jotform.com/form/XXX/submissions?apikey=XXX

    Não encontrei informações exemplificando como enviar os arquivos de anexo, então gostaria de uma orientação.

    Obrigado desde já,

    Rian da Rosa Hofstatter.

  • Ryan Jotform Support
    Respondido em 28 de novembro de 2023 às 12:34

    Hi Rian,

    Thanks for reaching out to Jotform Support. Unfortunately, our Portuguese Support agents are busy helping other Jotform users at the moment. I'll try to help you in English using Google Translate, but you can reply in whichever language you feel comfortable using. Or, if you'd rather have support in Portuguese, let us know and we can have them do that. But, keep in mind that you'd have to wait until they're available again.

    Now, let me help you with your question. It seems you are trying to create a submission on your form using API. To clarify, are you not able to add a file when you use the API? If so, can you share with us the URL of your form so that we can check the fields? Also, can you share with us the code of your API when you try to call it with the file attachment so that we can check?

    After we hear back from you, we’ll have a better idea of what’s going on and how to help.

  • Suporte_Freedom
    Respondido em 28 de novembro de 2023 às 15:12

    Hi Ryan,

    I tried to submit in the form https://form.jotform.com/201683175497666 .


    Here's my code:

    try {

    final content = MultipartFile.fromFile(file.path);
    final contentType = 'multipart/from-data';
    final response = await dio.post(
    'https://api.jotform.com/form/201683175497666/submissions?apikey=XXX',
    data: FormData.fromMap({
    'file': content,
    "submission[52]": email,
    "submission[53][phone]": phoneController,
    "submission[69]": cpf,
    "submission[55]": cityController,
    "submission[61]": dropdownValue,
    "submission[56][options]": state,
    "submission[31]": serial,
    "submission[37]": message,
    "submission[78]": name,
    }),
    options: Options(contentType: contentType));
    print('Response: $response');

    } catch (error) {
    print('Error request: $error');
    return null;
    }
  • Richie Jotform Support
    Respondido em 28 de novembro de 2023 às 21:15

    Hi Rian,

    You can try getting your file upload field URL first then pass it to your upload field. This may not be possible dynamically. Here is an example File upload URL:

    submission[questionID]=https://www.jotform.com/uploads/Suporte_Freedom/90298233479972/4251618332338767339/2.PNG

    You can try to contact our API team for more information at this link.

    Let us know if there’s anything else we can help you with.

  • Suporte_Freedom
    Respondido em 29 de novembro de 2023 às 07:39

    Ok, but how I can send a new file to get this url?

  • Bojan Support Team Lead
    Respondido em 29 de novembro de 2023 às 12:19

    Hi Rian,

    Thank you for contacting Jotform support. Unfortunately, it is not possible to add files to Jotform submission directly. You need to add a direct URL to your submission data. Unfortunately, there is currently no other way to achieve this.

    Let us know if there is anything else we can help you with.

  • Suporte_Freedom
    Respondido em 30 de novembro de 2023 às 06:37

    Is there a way to upload images other than through a form?

  • Ryan Jotform Support
    Respondido em 30 de novembro de 2023 às 08:59

    Hi Rian, 

    Thanks for getting back to us. You can use a file hosting page where you can get the direct URL of the image. You can use Dropbox for example and see if it works on your end.

    Let us know if there’s anything else we can help you with. 

  • Suporte_Freedom
    Respondido em 7 de dezembro de 2023 às 09:28

    Hi, I tried to host my file and send URL but it didn't works. I need some advice.

    When I get my request, the answer is wrong.

    The answer of my request is:

    "58": {
    "name": "enviarArquivo",
    "order": "19",
    "text": "Enviar arquivo:",
    "type": "control_fileupload",
    "answer": [
    "https://www.jotform.com/uploads/Suporte_Freedom/201683175497666/5777670055819038922/https_wbdxlpribwqtjyqobzcd.supabase.co_storage_v1_object_public_profiles_92d26ec8-6de5-4e2f-881b-1dc303917050_new_70baf9d0-5691-46dd-b840-c949d4035bb08220433959039200944.jpg"
    ]
    }

    Could you help me?

  • Elton Support Team Lead
    Respondido em 7 de dezembro de 2023 às 21:40

    Hi Support_Freedom,

    Thanks for getting back to us with an example. That helped me understand what was happening. I was able to replicate the issue when I also tried to send external file URLs as the value. As a result, the external file URLs were sanitized and prepended with the Jotform file URL, as shown in the screenshot below.

    Send Files through API: External file URLs are prepended with Jotform URL Image 1 Screenshot 30

    It seems at the moment, it only accepts file URLs that originated from Jotform because it did not break the file URLs.

    Send Files through API: External file URLs are prepended with Jotform URL Image 2 Screenshot 41

    Unfortunately, I don't know any other solution aside from uploading the files manually in the form, so I have escalated this to our Developer team to look for more possible solutions or if they could allow external file URLs. As soon as we have an update, we'll let you know. We appreciate your patience and understanding.

    Let us know if you have any other questions.

  • Zahir Ölmez Jotform Developer
    Respondido em 8 de janeiro de 2024 às 10:06

    Hi Rian,

    Thank you for contacting Jotform support. Unfortunately, it is not possible to add files to Jotform submission directly in API. Unfortunately, there is currently no other way to achieve this. I have changed this thread type as Feature Request.

    Let us know if there is anything else we can help you with.