Remove file field after Transloadit upload

Santiago's Avatar

Santiago

28 Oct, 2013 10:14 AM

Hi everyone,

I'm using Transloadit at my site to avoid server load while uploading files, but I've just realised the user file is being uploaded to my server after Transloadit process.

How can I remove the file field from my form after Transloadit process to just get transloadit response so my server not to receive the user file?

  1. 2 Posted by Francisco Azevedo on 28 Oct, 2013 10:32 AM

    Francisco Azevedo's Avatar

    Hi santiago,
    If you get files you are defining a transload export robot. On that robot you can define files that you want to get.

    Best,
    Francisco Azevedo

  2. 3 Posted by Santiago on 28 Oct, 2013 12:24 PM

    Santiago's Avatar

    Thanks Francisco.

    The actual problem is that I've got this field at the form:

    <input type='file' name='image'>

    That field is the one used by Transloadit to process and upload my file to Amazon S3, and its populated by the user.

    Since transloadit is doing all the work, my server doesn't need the receive that file, but the form is sending me it any way.

    I'm thinking about removing the field after Transloadit success:

    = transloadit_jquerify "form", {onSuccess: "function(){$('form').find('input[type=file]').remove(); }"}

    Is it a good approach?

  3. Support Staff 4 Posted by Tim Koschützki on 28 Oct, 2013 02:29 PM

    Tim Koschützki's Avatar

    Hey Santiago,

    if the form is using our jQuery plugin (and it seems it does), it should not send you the file at all. Do you have any special kind of integration that might make this possible?

    Do you mind sharing your custom javascript code that calls our jQuery plugin?

    Kind regards,
    Tim

    Co-Founder Transloadit
    @tim_kos

  4. 5 Posted by Francisco Azevedo on 28 Oct, 2013 03:39 PM

    Francisco Azevedo's Avatar

    Hi Santiago,
    As Tim said, your transloadit form will not send file to your server.
    When someone clicks on file chooser, file will be uploaded to transloadit servers. Then, after upload, user can upload another one, or click on a optional submit button if you created inside form. If user clicks on that submit button, you will receive a transloadit information string only about latest upload.. and you should not receive file data.

    An optional javascript code to hide form or file field after onsucess sounds good too. The only problem i see here is that, if user uploads a wrong file and wants to change and upload a better file, he as no option, because file field will be removed on first upload.

    best,
    Francisco Azevedo

  5. 6 Posted by Santiago on 29 Oct, 2013 12:43 PM

    Santiago's Avatar

    Hi again! Thanks so much for the answers. The file keeps beeing uploaded to my server.

    Here is a mock of my form:

    <form accept-charset="UTF-8" action="/users/1" class="edit_user" enctype="multipart/form-data" id="update_user_1" method="post">
        <input name="params" type="hidden" value="{&quot;template_id&quot;:&quot;BBBBB&quot;,&quot;auth&quot;:{&quot;key&quot;:&quot;AAAAAA&quot;,&quot;expires&quot;:&quot;2013/10/29 13:01:51+00:00&quot;}}"><input name="signature" type="hidden" value="3c82171333541635adfeb392c5ecb11b6a475da0">
        
        <input id="user_avatar_chooser_1" name="user[avatar]" type="file">
                  
        <script type="text/javascript">
        //<![CDATA[
      
              jQuery(function($) {
                var script = '//assets.transloadit.com/js/jquery.transloadit2-latest.js';
      
                $.getScript(script, function() {
                  $('#update_user_1')
                    .attr('enctype', 'multipart/form-data')
                    .transloadit({"wait": true,
        "processZeroFiles": false,
        "triggerUploadOnFileSelection": false,
        "modal": false,
        "onSuccess": function(){$('#update_user_1').find('input[type=file]').remove(); }});
                });
              });
          
        //]]>
        </script>
                 
        <input class="real_submit" name="commit" type="submit" value="">
    </form>

    You can see the function I'm proposing at "onSuccess"

  6. Support Staff 7 Posted by Tim Koschützki on 04 Nov, 2013 05:03 PM

    Tim Koschützki's Avatar

    Hey Santiago,

    do you still have this problem?

  7. 8 Posted by Santiago on 04 Nov, 2013 05:16 PM

    Santiago's Avatar

    Sure, I'm using the approach I've describing at my previous post, but it looks little solid. You said Jquerify plugin should autoremove my file input but somehow it's not working.

    Thanks for the help.

  8. Support Staff 9 Posted by Tim Koschützki on 05 Nov, 2013 06:40 AM

    Tim Koschützki's Avatar

    Can you please post a link to where you have this online? I need to see it in action.

    Thanks,
    Tim

  9. 10 Posted by Santiago on 06 Nov, 2013 08:19 AM

    Santiago's Avatar

    Hi Tim, Thanks so much.

    You can check it out at http://www.beperk.com

    If you create an account, you can find it at "Account" option while changing your avatar, of while creating a new Service of managing your images.

    If creating an account it's not a good idea here you can create a service without an account:
    http://www.beperk.com/?buy_or_sell=true
    Choose "I offer" > "General Service" > "+ Cover photo"

  10. Support Staff 11 Posted by Tim Koschützki on 13 Nov, 2013 06:21 AM

    Tim Koschützki's Avatar

    Hey Santiago,

    sorry for the delay.

    I just tried it and it worked fine. I also could not find any reference to Transloadit in the source code. I went to "Edit profile" -> View Page Source -> and search for "transloadit" and nothing came up. Can you please point me to the script file that has this?

    Kind regards,
    Tim

    Co-Founder Transloadit
    @tim_kos

  11. Support Staff 12 Posted by Tim Koschützki on 10 Dec, 2013 06:45 AM

    Tim Koschützki's Avatar

    I am going to close this ticket for now. Please feel free to reopen it again if you have further questions.

    Kind regards,
    Tim

    Co-Founder Transloadit
    @tim_kos

  12. Tim Koschützki closed this discussion on 10 Dec, 2013 06:45 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

Recent Discussions

25 Aug, 2014 12:05 PM
14 Aug, 2014 07:02 AM
13 Aug, 2014 12:21 PM
29 Jul, 2014 12:48 PM
23 Jul, 2014 01:49 PM

 

22 Jul, 2014 11:09 AM
21 Jul, 2014 07:29 AM
18 Jul, 2014 12:49 PM
17 Jul, 2014 08:25 AM
17 Jul, 2014 07:22 AM
16 Jul, 2014 01:17 PM