Abdullah Md. Zubair
Abdullah Md. Zubair

Reputation: 3324

get access to a file of another PC through NSURL

I can access to my local file through NSURL by using:

    NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"file://localhost/Users/user/Desktop/lucky_numbers.json"]];  

But I need to get access of a file of another PC. I tried:

NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"file://foyzulkarim:[email protected]/localhost/Users/foyzulkarim/Desktop/lucky_numbers.json"]];

and

NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"file://192.168.1.48/localhost/Users/foyzulkarim/Desktop/lucky_numbers.json"]];

and

NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"file://Foyzul-Karims-MacBook.local/localhost/Users/foyzulkarim/Desktop/lucky_numbers.json"]];

But Error shows NSURLError domain code -1100

Please help me if anyone knows how to do this.

Upvotes: 0

Views: 458

Answers (2)

Abdullah Md. Zubair
Abdullah Md. Zubair

Reputation: 3324

You can access to my local file through NSURL by using: NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"file://192.168.1.48/localhost/Volumes/foyzulkarim/Desktop/lucky_numbers.json"]];

but, to do this you have to first connect with that PC manually.

Upvotes: 0

DarkDust
DarkDust

Reputation: 92394

I doesn't work that way. The file: URI scheme only supports local file access, not remote. For remote access you need a real network protocol like HTTP or FTP and thus a server on the remote site.

Upvotes: 2

Related Questions