Jump to content

Copying Files from Local Machine


iambaz

Recommended Posts

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
Link to comment
Share on other sites

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.
Link to comment
Share on other sites

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. :)
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.