Before updating to Windows 10 you may need to return your Pro license. More information here

File upload from within unity


Is it possible to create a file upload input box within unity? I know it is possible to upload files using unity using the www class functions but I can't find anything for selecting a file from a local machine to then upload.



more ▼

asked Nov 24, 2010 at 09:59 AM

avatar image

user-6747 (google)
3 6 4 8

(comments are locked)
10|3000 characters needed characters left

2 answers: sort voted first

You can question all files and folders trough the following code:

    DirectoryInfo info = new DirectoryInfo(@"C:\");
    foreach (FileInfo file in info.GetFiles())

Then get a filestream of your wanted file using

FileStream fileStream = new FileStream("Path here", FileMode.Open);

And use that stream in your upload. Dont forget to import System.IO.

(This code is C#, as far as i know you cannot do this with Javascript)

more ▼

answered Nov 24, 2010 at 10:16 AM

avatar image

662 7 8 21

thanks for your speedy reply Maarten. With this I would have to create some sort of file selection window myself wouldn't I?

Nov 24, 2010 at 10:40 AM user-6747 (google)

Yes you should. There is no component in Unity to do this. But it wouldnt be really hard to create one with the GUI components that are available.

Nov 24, 2010 at 11:13 AM Maarten

ok great, I'll look into doing that then. Thanks again.

Nov 24, 2010 at 11:15 AM user-6747 (google)

Forgive me, but how is the Filestream used with the WWW object for uploading, exactly?

Dec 10, 2010 at 11:30 PM DaveA
(comments are locked)
10|3000 characters needed characters left

Can anyone tell me how to upload a scene file through Winscp? How should I save the file? I am having maximum trouble here.

more ▼

answered Feb 25, 2013 at 09:32 PM

avatar image


(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments



asked: Nov 24, 2010 at 09:59 AM

Seen: 3958 times

Last Updated: Feb 25, 2013 at 09:32 PM