assassin316 Posted January 19, 2012 Share Posted January 19, 2012 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 Quote Link to comment https://forums.phpfreaks.com/topic/255372-php-newbie-need-help-with-file-upload/ Share on other sites More sharing options...
blacknight Posted January 19, 2012 Share Posted January 19, 2012 both... php can only access the website folder not previous lower level directories if im not mistaken so you would need a server side batch file to move the file from the mydocuments to the webfolder or vise versa Quote Link to comment https://forums.phpfreaks.com/topic/255372-php-newbie-need-help-with-file-upload/#findComment-1309304 Share on other sites More sharing options...
SergeiSS Posted January 19, 2012 Share Posted January 19, 2012 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. Quote Link to comment https://forums.phpfreaks.com/topic/255372-php-newbie-need-help-with-file-upload/#findComment-1309327 Share on other sites More sharing options...
assassin316 Posted January 19, 2012 Author Share Posted January 19, 2012 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 ?? Quote Link to comment https://forums.phpfreaks.com/topic/255372-php-newbie-need-help-with-file-upload/#findComment-1309330 Share on other sites More sharing options...
dzelenika Posted January 19, 2012 Share Posted January 19, 2012 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 ... Quote Link to comment https://forums.phpfreaks.com/topic/255372-php-newbie-need-help-with-file-upload/#findComment-1309345 Share on other sites More sharing options...
SergeiSS Posted January 19, 2012 Share Posted January 19, 2012 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. Quote Link to comment https://forums.phpfreaks.com/topic/255372-php-newbie-need-help-with-file-upload/#findComment-1309360 Share on other sites More sharing options...
assassin316 Posted January 19, 2012 Author Share Posted January 19, 2012 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!! Quote Link to comment https://forums.phpfreaks.com/topic/255372-php-newbie-need-help-with-file-upload/#findComment-1309379 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.