0

I am Downloading a file from service into the iPhone of type txt and I view the file into a UIWebview that works perfectly.

But when I set the file attribute hidden on the server before I Download it, the UIWebview can't load the file, on the webview delegate webView:didFailLoadWithError: I receive the following error:

 Error Domain=NSURLErrorDomain Code=-1102 "You do not have permission to access the requested resource."

Can I change the File attribute hidden after I download the file? or there is other solution for this?

Ahmad Kayyali
  • 8,233
  • 13
  • 49
  • 83
  • Why do you need the hidden file attribute? Are you trying to hide the file from other apps? Since the hidden file attribute is mostly used to hide system files form the user in the Finder/Terminal I don't see why you need this on the iPhone where there is no direct access to the file system for the user. Beside jailbreaking of course. – sliver Jun 02 '11 at 10:42
  • @sliver: let me put you in the picture, we have a Backup application on Windows platform which upload files into a cloud server, And in the iPhone side I View these files as a part of the Backup process, we have users make their own personal files `Hidden` and they choose to back them up, and all I wanted to do is to view them in the iphone – Ahmad Kayyali Jun 02 '11 at 11:17

2 Answers2

1

Found the solution, all I needed to is to change the mode of the file using C Code as follow:

 #include <sys/stat.h> 

 int result = chmod(const char *pathname, mode_t mode);

if result returns 0 If successful -1 if unsuccessful

And change the mode argument as you need.

Reference: chmod() — Change the Mode of a File or Directory

Ahmad Kayyali
  • 8,233
  • 13
  • 49
  • 83
0

I don't know why you are trying to make a file hidden on your web server. If it is so that it will not show in a directory listing, then you could try and use a "." (on all variants of unix, including MacOS X, a file that begins with a period is "hidden"), instead of the hidden file attribute (which is specific to MacOS X), and then try to customize access to hidden files by customizing .htaccess, with the help of this article.

sergio
  • 68,819
  • 11
  • 102
  • 123
  • These Hidden files got the hidden attributes in Windows Environment before I download them into tthe iPhone, the weird thing when i receive'em into the iPhone they got Ready only attribute, please check my answer below seems changing the file permission did the trick. – Ahmad Kayyali Jun 04 '11 at 08:18