Hello
I got a problem with uploading files.
Look at the code:
My.Computer.Network.UploadFile ("D:\file.txt", "http://www.onh1986.com/file.txt", username, password)
And I set permission to "777".
And it couldn't to upload the file.
What's problem, please
Thanks & Regards

How to upload files
2162
Bear23
Then try using ftp:// instead of http:// would be my best suggestion - it's possible that the service provider has set something to prevent a direct upload using http (that's just a guess, since this is usually the cause of the error you are seeing).
JGttttt
Something like
< php
Check POST-VARIABLES for uploading File
If (IS_FILE_TO_UPLOAD) then
MOVE THIS FILE TO SOME DIR
end if
>
zort15
R1ZWAN
The file "file.txt" exists on my server and I set permission to "777" for it.
And I'm trying to upload it, but it doesn't work.
ReneeC
You make a call to a webserver via http. This meens, that the webserver has to do something with your call. What you do is to request the file file.txt from your webserver and send a file for uploading (I suppose the file "file.txt" doesn't exist on the server).
There are some ways to manage an upload: FTP, HTTP, Services,... Depending on your decision the upload has to be handled.
Via HTTP, you may use PHP, PERL or ASP to manage the upload:
You need to request a script on the server, something like "manageUpload.php" (which you will have to write). Your Command may look like this:
My.Computer.Network.UploadFile ("D:\file.txt", "http://www.onh1986.com/manageUpload.php", username, password)
Otherwise you can try to upload your file via FTP, which should be also supported bei VisualStudio.
Regards,
Torben
Prabu.
I couldn't upload the file using FTP in VB2005 and I entered the username and password.
DotNetDoctor
No, I can't upload it if it doesn't exist.
But I can upload it using FTP.
R.K.S.
Okay...is the reason why a secret Do we need to guess
I've had success using FTP uploads, as long as the server allows it, which presumably it does since you say you can upload the file using some other FTP program.
BJHop
there will nothing be uploaded until you write some server-sided-script, which does the upload (manages the incoming POST). Since you use a HTTP request, it's like calling the url in a webbrowser.
You can't call a txt-file on your server and expect this to be uploaded or overwritten - otherwise this would be a very big bug. Take a look at http://de3.php.net/manual/de/function.is-uploaded-file.php
If you would do it by using ftp in your programm, you may directly access the directories and files on your server. This works if you use your login & password to identify.
These are these two possibilities. You may post your errors as long as you like to - this won't change the handling of HTTP-Requests at all.
John.Doe
"The remote server returned an error: (405) Method Not Allowed."
What does that mean
Thanks
Timmy0614
Can you upload it if it doesn't exist Can you upload it using another program Can you upload it using FTP
(try to eliminate the causes fo the failure).
Wael Sayed
Without this script, there will never be an upload - would be the same as calling
My.Computer.Network.UploadFile ("D:\file.txt", "http://www.microsoft.com/file.txt") !
By the way, username and password are only needed if there is a password-controll (like .htaccess) on the server protecting your upload-script.
Regards,
Torben
DMarin
An error occured: look at it:
"An exception occurred during a WebClient request."