Link to home
Start Free TrialLog in
Avatar of pcjunky
pcjunky

asked on

Problem Uploading files with Webclient.uploadfile()

I'm trying to write a program to allow a user to select a file(in particular image files) and upload it to a remote server.  Currently I'm to use the webclient uploadfile method.  If I use it with the "POST" verb I get a eror from the server: method not allowed.  I've tried the "PUT" verb as suggested by another question here at experts=exchange.  The file gets uploaded, but can no longer be opened, there are errors in the file.  I tried a textfile as well, it could be opened but there was added text.  Any help is as always appreciated.  I'm also not set in stone using uploadfile so if you have another way of uploading the files I'm willing to try them.  Thanks in advance.

~pcjunky
ASKER CERTIFIED SOLUTION
Avatar of prakash_prk
prakash_prk
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of pcjunky
pcjunky

ASKER

Thanks parkash.  That seemed to do the trick.  The only issue I'm having is once I've uploaded the file I try to navigate to it with the web browser control on my form, but sometimes it won't show the picture and instead opens with windows picture and fax viewer.

Thanks again.
~pcjunky
oh sorry
I forgot to remove the codes
"settings.writetolog()... Which is simple a log written to a file...."
"the functions takes an arguament as progressbar and show the download status also...

can u say what is type of file u uploaded ( gir or jpg)....

regards
prakash
Avatar of pcjunky

ASKER

It's a jpg in both cases.  I tested it with the sample pictures that come with Windows (winter, sunset, etc).  The sunset.jpg works fine, but winter.jpg opens like I said.

~pcjunky
While you try to view that file in the browser, the image is not shown instead of that it opens fax or picture viewer !!!!

Is the Image shwon in pictureviewer??

regards
prakash
Avatar of pcjunky

ASKER

Yes when I try to navigate to the picture with the web browser control in my program it opens picture viewer instead of navigating to it.  The image is shown in picture viewer.

~pcjunky
Hello Prakash, this post looks to be what I'm looking for. ...plus is looks like it has some excellent features like tracking progress. I'm trying to upload a local file to a hosted server without user intervention.

I'm a newbie trying to figure out the above code. I'm using Web Matrix and VB.

In the above code how would I load the source location, destination location, source filename and destination filename ?