Jump to content

PHP newbie, need help with file upload ...


assassin316

Recommended Posts

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

Link to comment
Share on other sites

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).

Where do you have "My Documents" folder? On your computer, not on the server? If yes, you may use FTP. It could be at your server (where you have your PHP script) or at any other server. You might create a local application to do it.

 

But you may be sure that in any case it's impossible to load a file via PHP script (HTML page) without command from user. This is because of security reason.

Link to comment
Share on other sites

Where do you have "My Documents" folder? On your computer, not on the server? If yes, you may use FTP. It could be at your server (where you have your PHP script) or at any other server. You might create a local application to do it.

 

But you may be sure that in any case it's impossible to load a file via PHP script (HTML page) without command from user. This is because of security reason.

 

Oh no! I need to avoid interaction with the user since the interaction has already occurred in the Silverlight. If I pass the file path (from the My Documents folder in Windows) to a server-side PHP script that has the fopen() and fread() functions, it wouldn't work ??

 

Link to comment
Share on other sites

This is impossible.

Web server doesn't know almost nothing about client.

Imagine web server which interacts with clients filesystem and uploads or downloads files without user interaction. What as security flaw.

Communication MUST ALWAYS be initiated from client which sends request and server responser and so on ... 

Link to comment
Share on other sites

I need to avoid interaction with the user since the interaction has already occurred in the Silverlight.

OK. As I told you already :) you may use FTP. Just load your file to an FTP server - automatically from your Selverlight application - and then start PHP script. It will connect to FTP and download that file.

Link to comment
Share on other sites

I need to avoid interaction with the user since the interaction has already occurred in the Silverlight.

OK. As I told you already :) you may use FTP. Just load your file to an FTP server - automatically from your Selverlight application - and then start PHP script. It will connect to FTP and download that file.

 

I'll look into that SergeiSS, sorry for not responding to your earlier post. Thanks for that tip!!

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.