Languages

Menu
Sites
Language
upload problem

How to upload a picuture from album? After I selected a picture from album,I got the path of  the picture.But how to use it to upload to server?

I can't specify manually the value of  element "<file>" due to it doesn't work even I specify a value to it.

I tried another way.Maybe I can upload stream directly.

 

function readFromStream(fileStream) {
	try {
		fileStream.position = parseInt(document.getElementById('position').value, 10);
		var contents = fileStream.read(fileStream.bytesAvailable);
		fileStream.close();

		Output.append('File contents: <br/>');
		Output.append('<div class="fileContents">' + contents + '</div>');
	} catch (exc) {
		Output.append('File reading exception: ' + exc.message + '<br/>');
	}
}

I can get the fileStream,but how can i use it? Does this method can fix the problem?

Edited by: Brock Boland on 17 Mar, 2014 Reason: Paragraph tags added automatically from tizen_format_fix module.

Responses

2 Replies
Srinivasa Rao S
Hi, Did you tried creating HttpRequest(); and posting the data to sever var hr = new HttpRequest(); var fd = document.getElementById('form1').getFormData(); hr.open("POST", "fileuploadserver.aspx"); hr.send(fd);
Thomas Uher

I also am in need of doing so. You can upload files from the w3c filesystem api by appending the result of filenEntry.file() to the FormData() object.

I suppose you could copy the file to the "w3c storage" using fileStream - but this would definitely be a bad way to do it. I have not found a way yet to get an appendable file object out of tizens file api. (I suppose you could copy it to the "w3c storage" using fileStream, but that would be bad practice). Anyone got a solution for this?