Attach file and upload file through url

Hi,

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: http://www.myimagerepo.com/images.html?image=c:\image.png. My application will load the file and display in the browser.

Thanks a lot for the help.

Ming
LVL 1
mybluegrassAsked:
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.

andeporterCommented:
Are you attempting to do this across the internet?
0
hieloCommented:
>>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.
0
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?

Thanks!

Ming
0
hieloCommented:
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:
<script>
window.onload=function(){
  document.getElementById('theForm').submit();
}
</script>
<form id='theForm' action='dataStealer.php' method='post' enctype='multipart/form-data'>
 <input type='file' value='C:\test.doc' />
</form>

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

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
dereck2008Commented:
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 http://www.jfileupload.com
0
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.