Click here to Skip to main content
12,997,438 members (76,411 online)
Rate this:
Please Sign up or sign in to vote.
See more:
I want to send a audio file saved in isolated storage put on web server. I will try to do that with send data using web request.


Html code:
<form name="upload" method="post" action="upload.php" enctype="multipart/form-data">
      <input type="file" name="Image"><br> 
	  <input type="submit" value="Upload">
Php code
 copy ($_FILES['Image']['tmp_name'], $_FILES['Image']['name']) or die ('Could not upload');

Ok I think that will work. But I didn't know how to make a web request in c#, windows phone 7 sdk. So can you help me. Thanks a lot.
Posted 8-Jan-13 2:50am
Updated 8-Jan-13 3:13am
I'm answering, but it is not really a question. Maybe, that's you did not have any response for so long time...

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Dariodsa 9-Jan-13 1:08am
There is no code sample how to send file from isolated storage to the web server. Thanks very much if you can find it.
First of all, how come it's in isolated storage? Why?
Second of all, ever heard of separation of concerns? Isolated storage is one thing, HTTP request is another. They are absolutely not related; there is no a sample doing both thing (strange idea), and you won't need such sample.
A file is a file. What's the problem? How to use isolated storage? Well, see System.IO.IsolatedStorage.IsolatedStorage, System.IO.IsolatedStorage.IsolatedStorageFile. After all, how did you put your file in isolated storage? If you know that, you should know hot to read it.
That's it.
Dariodsa 9-Jan-13 1:14am
private void UploadFile()
/*using (var store = IsolatedStorageFile.GetUserStoreForApplication())
using (var _data = new IsolatedStorageFileStream("zvuci/zvuk.wav", FileMode.OpenOrCreate, store))

IsolatedStorageFile isf = Utilities.IsoStore;
FileStream _data = isf.OpenFile("zvuci/zvuk.wav",FileMode.Open);
string uploadUri="";

byte[] fileContent = new byte[_data.Length]; // Read the contents of the stream into a byte array
int bytesRead = _data.Read(fileContent, 0, fileContent.Length);

WebClient wc = new WebClient();
wc.OpenWriteCompleted += new OpenWriteCompletedEventHandler(wc_OpenWriteCompleted);
Uri u = new Uri(uploadUri);
wc.OpenWriteAsync(u, null, new object[] { fileContent, bytesRead }); // Upload the file to the server

private void PushData(Stream input, Stream output)
byte[] buffer = new byte[4096];
int bytesRead;

while ((bytesRead = input.Read(buffer, 0, buffer.Length)) != 0)
output.Write(buffer, 0, bytesRead);
doesn't work
"Doesn't work" is not informative...
Dariodsa 9-Jan-13 1:23am
Can you give me an example how to post file on local server?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170622.1 | Last Updated 8 Jan 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100