Jump to content


Photo

Copying Files from Local Machine


  • Please log in to reply
7 replies to this topic

#1 iambaz

iambaz
  • Members
  • Pip
  • Newbie
  • 4 posts

Posted 11 July 2006 - 05:24 PM

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

#2 micah1701

micah1701
  • Members
  • PipPipPip
  • Advanced Member
  • 613 posts
  • LocationEllington, CT USA

Posted 11 July 2006 - 05:27 PM

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.
"Confidence in the face of risk."

#3 trq

trq
  • Staff Alumni
  • Advanced Member
  • 31,041 posts

Posted 11 July 2006 - 05:39 PM

If your local machine is running php take a look at the ftp functions.

#4 ShogunWarrior

ShogunWarrior
  • Members
  • PipPipPip
  • Advanced Member
  • 528 posts
  • LocationIreland

Posted 11 July 2006 - 07:40 PM

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. :)
<a href="http://www.daviddora...nmedia.com/">My New Site/Blog</a> | <a href="http://www.daviddora...m/check/">Check your page for broken links/images/scripts</a>

Zend Certified Engineer
Follow me on Twitter: http://twitter.com/davidd

#5 iambaz

iambaz
  • Members
  • Pip
  • Newbie
  • 4 posts

Posted 12 July 2006 - 03:33 PM

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

#6 ShogunWarrior

ShogunWarrior
  • Members
  • PipPipPip
  • Advanced Member
  • 528 posts
  • LocationIreland

Posted 12 July 2006 - 03:55 PM

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.
<a href="http://www.daviddora...nmedia.com/">My New Site/Blog</a> | <a href="http://www.daviddora...m/check/">Check your page for broken links/images/scripts</a>

Zend Certified Engineer
Follow me on Twitter: http://twitter.com/davidd

#7 iambaz

iambaz
  • Members
  • Pip
  • Newbie
  • 4 posts

Posted 12 July 2006 - 04:18 PM

Hmmm, yes I never really tought the implications of it through properly. Back to the drawing board!

Thanks for your help!


#8 Buyocat

Buyocat
  • Members
  • PipPipPip
  • Advanced Member
  • 267 posts

Posted 12 July 2006 - 05:09 PM

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.
Looking for some easy-to-use tools?  Try these, https://sourceforge....jects/utils-php -- I made them myself.  They're distinct tools which are easy to understand and use.  See some examples uses at http://www.anotherearlymorning.com




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users