PHP newbie, need help with file upload ...

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
assassin316
Forum Newbie
Posts: 1
Joined: Wed Jan 18, 2012 6:44 pm

PHP newbie, need help with file upload ...

Post by assassin316 »

Hi,

I'm an experienced developer in desktop development, but am completely new to web technologies (except Silverlight 4). I need help uploading a file from a user's machine to my web hosting server. Here's my scenario:

I have a Silverlight application which saves a temporary image to the My Documents folder. I need a PHP script which will take this image (a JPG image) and copy it to a server folder (without any use of a web form).

Can anyone point me to a good tutorial that shows this? I cannot find one. They all use Form/Submit buttons, and I can't have that.

Also, does this functionality require both client-side and server-side scripts, or just server-side?

Thank you for your time!

Max
User avatar
twinedev
Forum Regular
Posts: 984
Joined: Tue Sep 28, 2010 11:41 am
Location: Columbus, Ohio

Re: PHP newbie, need help with file upload ...

Post by twinedev »

I think you need to clarify what you mean by "without any use of a web form". Do you mean that you want it to just grab a known filename from a known location?

If you are talking about using PHP as a script running on your web server, you will need some interactivity or at least a program written on your computer to submit the file to your server. This is because of security issues (image if you browse to a site and it could just read and grab any file it wanted off of your system...)

At the very least I would see a form that has only the File select input and a submit, so the user can pick the file, but you say you don't want any type of form. So there you are back to needing a custom program to run on the client system to send it to the server. (in which case, why not just do FTP?)

-Greg
Post Reply