uploading a file in a website

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jcor
    New Member
    • Sep 2007
    • 63

    uploading a file in a website

    HI,
    I need every day to upload several files to a website (go to site, click "browse", wait for the upload and its done).
    I'd like to automate this with a perl script, but I can't figure how.
    MY idea is to be monitoring a folder and upload every files that is copy to there. Can someone give me some lights to start a scratch of the script, the problems I could find, modules that can help, etc.

    Thanks a lot for any help,

    João Correia
  • eWish
    Recognized Expert Contributor
    • Jul 2007
    • 973

    #2
    You could write a script that will transfer the files based on the criteria you desire. Then setup a Cron Job or Scheduled Task that transfers the files for you at said times of the day.
    • Use File::Find to get the files
    • Use Net::FTP to transfer files
    • Create Cron Job / Scheduled Task.


    --Kevin

    Comment

    • jcor
      New Member
      • Sep 2007
      • 63

      #3
      I already have something like what you said but with File::Monitor and Net::FTP.
      My problem is that the site is not a ftp server and I don't think I can upload files to there via ftp. But I don't have a clue of how can I do that. Imagine you want to upload a video to youtube.com, You can do that via ftp? You must browse your computer and upload it. It's something ike that I need.

      thanks for your help,

      João

      Comment

      • numberwhun
        Recognized Expert Moderator Specialist
        • May 2007
        • 3467

        #4
        Originally posted by jcor
        I already have something like what you said but with File::Monitor and Net::FTP.
        My problem is that the site is not a ftp server and I don't think I can upload files to there via ftp. But I don't have a clue of how can I do that. Imagine you want to upload a video to youtube.com, You can do that via ftp? You must browse your computer and upload it. It's something ike that I need.

        thanks for your help,

        João
        If the file selection is what you are trying to do, then you can do that with HTML. You would do an input box in a form and set the type to file and it should have a button to click. Check on the w3c website for more information.

        Regards,

        Jeff

        Comment

        • jcor
          New Member
          • Sep 2007
          • 63

          #5
          What I really would like to do is, and a I don't now if it's possible or how to do it is:

          Start running a script that upload every files in a particular folder to one particular site, like if I have clicked the button, browse, and uploaded the file. I don't know how I could identify the site or the field in the site where the file should be uploaded, guess it can be hard to do.

          Just wondering if its possible, and trying to get some ideas to do this.

          Thanks,

          João

          Comment

          • numberwhun
            Recognized Expert Moderator Specialist
            • May 2007
            • 3467

            #6
            Originally posted by jcor
            What I really would like to do is, and a I don't now if it's possible or how to do it is:

            Start running a script that upload every files in a particular folder to one particular site, like if I have clicked the button, browse, and uploaded the file. I don't know how I could identify the site or the field in the site where the file should be uploaded, guess it can be hard to do.

            Just wondering if its possible, and trying to get some ideas to do this.

            Thanks,

            João
            Ok, I now believe that you are completely confused and truly do not know what you want.

            In your last post, you asked how it is possibly to upload something by clicking on a button, browsing for the file you want to upload, then uploading it. I gave you an answer to that and then you go and describe something TOTALLY different.

            You need to sit down and describe EXACTLY what it is that you want to do. Don't say, "like this but do this instead". Uploading a file by selecting it and uploading all the files in a directory with a script are two different things and not even closely like each other.

            Once you can accurately describe exactly what it is you are looking for, please feel free to post it here and we will see if we can help you. Also, it would help dramatically if you post the code you are working with if that is what you are trying to troubleshoot.

            Your changing your statement every other posting makes me think we are wasting our time trying until you better describe what you want to do.

            Regards,

            Jeff

            Comment

            • jcor
              New Member
              • Sep 2007
              • 63

              #7
              Sorry for the confusion. I'll try to be clear now:

              I need to distribute several files to several destinations.
              The files are created in any computer of my network and when finished are stored in a specific folder and computer.

              one destination is to send via FTP;
              other destination is to send via SFTP;
              other destination is to send uploading the file in a site (as I tried to describe before)

              I already automated the first to "sendings", using File::Monitor to be watching the specific folder, and every file dropped in that folder is sent using modules Net::FTP and Net::SFTP.

              For the third place, I'm not working in any code yet, just start thinking how could be done. Probably I can use the "watching" in my script. But the uploading part, I don't have a clue.

              Hope I've been clear this time and you can help me

              thanks,

              João

              Comment

              • Atli
                Recognized Expert Expert
                • Nov 2006
                • 5062

                #8
                Hi João.

                The only way I can think of would be to have your code send a HTTP request to the server, just like your browser would.
                I'm afraid I do not know Perl well enough to say exactly how you would accomplish this, but I would think Perl has some way of using Sockets? If so then that would probably do the trick.

                Comment

                • KevinADC
                  Recognized Expert Specialist
                  • Jan 2007
                  • 4092

                  #9
                  If the site you want to upload to already has a form you use to upload files, then you can most likely use the WWW::Mechanize module. But if the site uses javascript you can't because WWW::Mechanize does not support javascript. Search CPAN fo the module.

                  Comment

                  • jcor
                    New Member
                    • Sep 2007
                    • 63

                    #10
                    thanks for your help guys, was really something like WWW::Mechanize what I was looking for. I'll write the script and let you know how it's going.

                    thanks again,

                    João

                    Comment

                    Working...