iambaz Posted July 11, 2006 Share Posted July 11, 2006 Hi,I am trying to create a script that will upload a file from my local machine onto my web server. I do not want to use a form, I want it to be automated within the script. I have looked for tutorials, but all seem to deal with copying files around the server but not from the local machine. Is this possible? If so, could somebody point me in the right direction? Any help would be apreciated.Cheers Quote Link to comment Share on other sites More sharing options...
micah1701 Posted July 11, 2006 Share Posted July 11, 2006 it might be possilbe if your server IS your local machine - but otherwise you HAVE to use a form that has the client side user select a file to upload.it would be a pretty big security problem if you could just start uploading files to your website from any user's computer. Quote Link to comment Share on other sites More sharing options...
trq Posted July 11, 2006 Share Posted July 11, 2006 If your local machine is running php take a look at the [url=http://php.net/ftp]ftp[/url] functions. Quote Link to comment Share on other sites More sharing options...
ShogunWarrior Posted July 11, 2006 Share Posted July 11, 2006 This implies the server has absolute control over your machine.As micah said, you have SOME options if you're on localhost, because you may be able to execute commands to move files around but that would be moving files on the server which you mentioned it was not. So there isn't an answer from me. :) Quote Link to comment Share on other sites More sharing options...
iambaz Posted July 12, 2006 Author Share Posted July 12, 2006 Ok, well slightly off topic but a continuation of the original problem, does anybody know if it is possible to upload a file through a form but without the file upload dialogue box, ie php could get a local file path from database, and then through a form, this file is uploaded and then I could get it with $_FILES var using PHP? Basically I would be eliminating the users choice of what file to upload and replacing it with a pre set filepath.I know this is probably going to be a javascript so apologies, but if anybody knows if it is possible or not, that would be great.Thanks in advance Quote Link to comment Share on other sites More sharing options...
ShogunWarrior Posted July 12, 2006 Share Posted July 12, 2006 I'm not aware of a way to change the value of a file input but I have seen implementations of multiple uploads through Javascript, but it still seems a bit intrusive which may mean that it is not supported. Quote Link to comment Share on other sites More sharing options...
iambaz Posted July 12, 2006 Author Share Posted July 12, 2006 Hmmm, yes I never really tought the implications of it through properly. Back to the drawing board!Thanks for your help! Quote Link to comment Share on other sites More sharing options...
Buyocat Posted July 12, 2006 Share Posted July 12, 2006 What exactly is it that you want? A way to add new files to a server automatically? Because I know there are many ways to do this with a FTP program (at least on a mac, though I imagine there are even more ways to do it with Windows). This would allow you to say, put a file in a "dropbox" folder that is checked nightly for updates and sync'd with the server. If you wanted to add some extra bells and whistles - say update a DB with a new table entry representing the new file - you could create a cron script that runs nightly (but after the FTP one) and executes some PHP. For example it might check the uploads folder on your server and if it finds a new file it adds it to the DB. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.