Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

FTP via Web

Status
Not open for further replies.

1DMF

Programmer
Jan 18, 2005
8,795
GB
Is it possible to use Net::FTP to uplaod files to a websever from clients local machine?

How do you control the windows 'file dialog' to access local machine files and initiate file transfer?

ok I know there is the form field type 'file', but I don't want to upload via standard form submission and CGI.pm, it's too unreliable and cannot handle large files.

So what's the alternative?

Cheers,
1DMF

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!
 
Hi

1DMF said:
Is it possible to use Net::FTP to uplaod files to a websever from clients local machine?
No. Web servers are talking HTTP while Net::FTP talks FTP. They will not understand each other.
1DMF said:
So what's the alternative?
If you have an FTP server, then upload to that with Net::FTP. Otherwise upload to the web server with LWP.

Feherke.
 
Our web server is also FTP , I don't understand what your saying?

But I need the client machine to connect to the FTP account via a web interface.

So ok you suggest LWP, can you point me in the right direction on how you display a file dialog for user to select file, take the selection and send it via LWP to the FTP server?

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!
 
Hi

Wait. So your idea is to let the visitor do the file selection with a web page's [tt]form[/tt] but the uploading to be done by another software ?

In this case is certainly impossible. Modern browsers will not tell to anybody the selected file's location.

Last week I saw a page with Flash file uploader. Strangely it was able to pop up a file choosing dialog. And as far as I know, Flash can establish TCP connections too. So I would search for such Flash uploader, some could be able to talk FTP.

Feherke.
 
Wait. So your idea is to let the visitor do the file selection with a web page's form but the uploading to be done by another software?

err, yes and no, i think.

I want a button, which when clicked opens a local machine file dialog box for selection, user selects file for upload, user then clicks a button to upload the file, then my perl program uploads the file. - that isn't 'another software' is it, that's my software?

is that FTP::pUT or FTP::GET or LWP::pOST or LWP::GET methods?

Isn't this like as simple as 123? So far I've spent 2 hours going round in circles trying to find anything even close?

All I want is a Basic FTP capability from a web page?

Is perl not capable of doing such a thing?

Do I need to use PHP or Java, there seems to be plenty of Java applets out there for doing it.

I can't find a single bit of code doing it with perl?

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!
 
Hi

Maybe I misunderstood you from the beginning. Your Perl script will be a desktop application with GUI ? In that case yes, is doable with Perl and Net::FTP.

Feherke.
 
Nope, not a desktop perl app a webpage.

It's OK , I've realised what I want to do isn't possible with perl.

Any normal person would install an FTP client and be done with it, but unfortunately members/users are never normal!

What I want to do I don't think is possible, it probably breaches internet protocol security trying to 'take' a file from a local machine.

Though I don't understand how someone has done it with PHP, it must probably use the MIME encoded POST method, perhaps the only way possible with perl.

The only other alternative is to use either a flash, java or an activex plugin.

what would you recommend?



"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!
 
Hi

1DMF said:
Though I don't understand how someone has done it with PHP, it must probably use the MIME encoded POST method, perhaps the only way possible with perl.
I do not believe it can be done in PHP or anything else.
1DMF said:
The only other alternative is to use either a flash, java or an activex plugin.
As I mentioned, I would search for Flash uploader. Java applets have limitations imposed, by default it will not access local resources. ( Signed applets can, but with the user's explicit agreement. ) No idea what an activex plugin is.

Feherke.
 
I found this on doing it with PHP, but it only seems to have a GET method not PUT?


ActiveX is an MS platform, I guess .NET would do it also but I don't have .NET

I think Flash is possibly my best bet.

The things your employer expects you to pull out your *** eh!

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!
 
Hi

That is useful for example :
[ul]
[li]visitor requests the page [ignore][/ignore][/li]
[li]then product.php[ul]
[li]gets the prices in GBP from the database[/li]
[li]gets through FTP the exchange rate from [ignore]ftp://bank-of-my.country/rate.csv[/ignore][/li]
[li]converts the prices from Pound sterling to Japanese Yen[/li]
[li]generates the product detail page[/li]
[/ul][/li][/ul]
The point is, the PHP script will still run on the server machine, will play the role of an FTP client and will connect to an FTP server.

So your visitors who want to upload a file would need to have an FTP server on their machine and the file to upload to be placed inside the FTP server's document root. Even so, the path to a file visible through FTP is not the same as the file system path, so the file selection dialog window will not help.


Feherke.
 
Another spanner just ben thrown in the works...

Our webhost doesn't allow anonymous FTP, any FTP users have to supply us their IP and it's added to the sonic wall!

I'm just going to have to use HTTP and form POST and see what happens.

I might be able to assign any IP if using a specific FTP account, so will require further investigation.

Does anyone know the likely limit in terms of file size (not to mention CGI script timeout), using HTTP and POST to upload client files?

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!
 
Well it's our own dedicated server, but I know from previous experience that the CGI-TIMEOUT setting via the server registry does not work.

So it makes no odds, it seems the ActiveState perl version for Windows platform has an issue and nothing I do to try and give perl scripts as long as they want doesnt' work.

So I really don't know how i'm going to facilitate this web app?

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!
 
Once upon a time I implemented PHP file uploads based on something I found on the web so that a client could upload images to their web site... it was simple to implement and worked very well, and behaved in a similar manner to what you describe. Is it just file size that prevents you from using this method?

Annihilannic.
 
I can script HTTP MIME encoded uploads no problem but yes it's the file size which is the main issue.

I've already come across a client file 70mb+ and HTTP uploads just died.

Maybe it's a server configuration issue, I know there are some metabase settings you can change, but I've tried that without success, but who knows maybe I didn't do it right.

Maybe my other thread redarding that will shed more light?

If I had visual studio and could compile executables i'd roll a bespoke app for the job and have them download it and run it, but all I have is MS Access and even creating an MDE executable still requires the user to have MS Access installed as the runtime AFAIK...

Hey another question for the MS access forum I think - [lol]

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!
 
Can you get the user to zip the file first? Or is it a JPEG (i.e. already compressed)?

Steve

[small]"Every program can be reduced by one instruction, and every program has at least one bug. Therefore, any program can be reduced to one instruction which doesn't work." (Object::perlDesignPatterns)[/small]
 
I could, but again you're now expecting computer illiterate users to do things like zipping files!

I don't want to go down that route unless I can plug into the OS's built in zip functionality and zip em up for them!

I don't want to know about them having the trial version of WinZip and using it in a commercial environment, I don't need FAST breathing down my neck!

Would be good if they could, I might get them to run the backup-to-file process in their software as the resulting file is zipped already.

However that doesn't give us the data in the format we want, but it's certainly worth a thought.



"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!
 
No the data is on client machines I need loading onto the webserver

They are MS Access DB's

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!
 
Saving as csv could save some considerable space but it means users getting the settings right.

For non tech savvy users, most of my clients, I use an app written in Foxpro which both zips and FTP's a database backup. The problem with that is the source filename, destination and FTP details are programmed into the script so would be anon starter if the database names were not constant.

Keith
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top