469,337 Members | 6,157 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,337 developers. It's quick & easy.

uploading a file in a website

63
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
Nov 8 '07 #1
9 1545
eWish
971 Expert 512MB
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
Nov 9 '07 #2
jcor
63
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
Nov 9 '07 #3
numberwhun
3,503 Expert Mod 2GB
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
Nov 9 '07 #4
jcor
63
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
Nov 9 '07 #5
numberwhun
3,503 Expert Mod 2GB
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
Nov 9 '07 #6
jcor
63
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
Nov 9 '07 #7
Atli
5,058 Expert 4TB
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.
Nov 9 '07 #8
KevinADC
4,059 Expert 2GB
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.
Nov 10 '07 #9
jcor
63
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
Nov 12 '07 #10

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

4 posts views Thread by dickiedyce | last post: by
6 posts views Thread by Chamomile | last post: by
4 posts views Thread by Chris Dewin | last post: by
reply views Thread by Jason Franks | last post: by
16 posts views Thread by B Letts | last post: by
3 posts views Thread by Gavin | last post: by
2 posts views Thread by Erland | last post: by
5 posts views Thread by Chris | last post: by
4 posts views Thread by Rob Meade | last post: by
10 posts views Thread by =?Utf-8?B?RGFu?= | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.