• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by hello_world · Mar 09, 2011 at 06:27 PM · serverfiledownloadbrowserftp

How to Retrieve List of Files on FTP Server

I need to be able to obtain a list of files and/or the file hierarchy on my FTP server from any type of UNITY application (web, Desktop, iPad, etc.) so I can populate my file browser; once I have the addresses I know I can use the WWW class to download them (they will all be plain text files). Does anyone know how to do this?

Thanks!

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Bunny83 · Mar 09, 2011 at 09:58 PM

You should be able to use System.net.sockets even in Webplayer but you need to offer a Socket policy. Unity just says that sockets are restricted in the webplayer and you can't open listen sockets but you should be able to connect to your ftp if you can provide this policy.

I've found this article and the Unity MonoCompatibility page says that FtpWebRequest stuff will work inside the Webplayer. I don't know how Unity will check the crossdomain restrictions when using that classes, but in general I think it should be possible.

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image hello_world · Mar 24, 2011 at 04:15 PM 0
Share

Thank you for your suggestion. About FTPWebRequest - it works great on the Desktop and iPad, but it does not work for the Web Player; the error is: "error CS0117: System.Net.WebRequest$$anonymous$$ethods' does not contain a definition for Ftp'"

avatar image Bunny83 · Mar 24, 2011 at 04:54 PM 0
Share

Hmm, that's strange. It looks like Unity removed the definition for webbuilds. Depending on what FTP protocol version you use/want use you could handle the protocol yourself if you have the knowledge and time to create your own FTP client on top of sockets. But if your ftp-server have also a web-server I think it's much easier to create a php script that returns the directory listing as xml, csv, html, or what ever :D

avatar image
0

Answer by cmkbim · Jan 02, 2015 at 05:06 PM

The error you are getting can be resolved with passing the actual string value for the method and in your example of the list you will use NLST. But once you do this you will start getting the crossdomain.xml stuff.

 FtpWebRequest request = (FtpWebRequest)WebRequest.Create("ftp://xxx.com/www/");
 request.Credentials = new NetworkCredential("user", "password");
 request.Method = "NLST";
Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

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

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

1 Person is following this question.

avatar image

Related Questions

Download binary file from my FTP server 0 Answers

Unable to connect to remote server when downloading from FTP 0 Answers

How to Browse a photo or Open to gallery 3 Answers

Screenshot script not uploading PNG to server when used with key trigger 1 Answer

Upload to FTP Server 1 Answer

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges