Attach file and upload file through url


I'm wondering if it's possible to upload a file through url. For example, I got an image on my local computer, c:\image.png. I want to attach this file name with full path to a url:\image.png. My application will load the file and display in the browser.

Thanks a lot for the help.

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Are you attempting to do this across the internet?
>>I'm wondering if it's possible to upload a file through url.
No. You have to use a <form> and use the <input type="file"> element. Furthemore, the user must manually select the file. These features are in place for security reasons.
mybluegrassAuthor Commented:
Let me rephrase it. My main purpose is to be able to pass an image file located in my local computer to my web based application which is installed on a different linux server. I know now that automatically upload won't work, but is there a way to pass the image data, say, the bytes through the post method?


Again, for security reasons, the user MUST choose the file manually. If that were not the case I would be able to lure you to my site and visit some page with the following code:
<form id='theForm' action='dataStealer.php' method='post' enctype='multipart/form-data'>
 <input type='file' value='C:\test.doc' />

Then in the processing file I would just save the file and then redirect you to a legitimate page.  So there, I would have stolen your file without your knowledge. For this reason, even pre-setting the file name in the value of the input field is ignored by the browser. It will only send/submit the file unless the user chooses the file manually.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
You do need <input type='file' .. for HTML upload. Another solution could be an applet that will upload file for you. You have on at
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Networking Protocols

From novice to tech pro — start learning today.