0

I'm developing an application where i need to create pdf file based on user input and the save it to server so that i can again show in my application.

i have successfully created the pdf file at document folder but how to save it in server location? i have two thoughts

  1. should i have to create a network connection and the just give the url at path
  2. or just set tha path which will server url in path

    enter code here

    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *saveDirectory = [paths objectAtIndex:0];
    NSString *saveFileName = @"mypdffiel1.pdf";
    NSString *newFilePath = [saveDirectory stringByAppendingPathComponent:saveFileName];
    CreatePDFFile(CGRectMake(0, 0, 612, 792),filename,text1 ,text2);
    

what should change in path variable so that it can save in server url

JeremyP
  • 84,577
  • 15
  • 123
  • 161

2 Answers2

1

You cannot directy save files online. You should create a webservice (php, java, etc.) that allows you to POST your pdf and stores it.

You will be forced to use url connection and to set the correct request and headers. This other question could help.

Community
  • 1
  • 1
Stefan Ticu
  • 2,093
  • 1
  • 12
  • 21
  • thanks a lot for clearing my confusion so i need to make server connection ist the create pdf file store it in document folder n then send it to the server as post data – Sadaf Perween Apr 18 '11 at 13:05
  • exactly, good luck with that, it should be fairly easy (but not simple). – Stefan Ticu Apr 18 '11 at 14:27
0

you have to consider whether you have to use HTTP POST method or FTP method based on your server setup.If you want to use HTTP Post , see the link

Community
  • 1
  • 1
  • Thanks for clearing my confusion so i need to make connection ist then this pdf file to server as post data as we send image fiels. – Sadaf Perween Apr 18 '11 at 13:04
  • ya sure sorry i dont know much more as i m new to this website but i dont have more reputation as u have so i just ticked for upvote u have to wait for sometime untill i get 12 reputations – Sadaf Perween Apr 18 '11 at 13:38