Search Results

Search found 9 results on 1 pages for 'abdulsamad'.

Page 1/1 | 1 

  • post image and other data using mulipart form data in iphone

    - by abdulsamad
    Hi all I am sending some data and and an image to the server using multipart/form-data in objective C. kindly give me some Php code that how can i save the image on the server i am able to get the other variables on the server that i am passing with the image. kindly see my obj C code and php and tell me where i am wrong. your help will be highly appreciated. here i make the POST request. ////////////////////// NSString *stringBoundary, *contentType, *baseURLString, *urlString; NSData *imageData; NSURL *url; NSMutableURLRequest *urlRequest; NSMutableData *postBody; // Create POST request from message, imageData, username and password baseURLString = @"http://localhost:8888/Test.php"; urlString = [NSString stringWithFormat:@"%@", baseURLString]; url = [NSURL URLWithString:urlString]; urlRequest = [[[NSMutableURLRequest alloc] initWithURL:url] autorelease]; [urlRequest setHTTPMethod:@"POST"]; // Set the params NSString *path = [[NSBundle mainBundle] pathForResource:@"LibraryIcon" ofType:@"png"]; imageData = [[NSData alloc] initWithContentsOfFile:path]; // Setup POST body stringBoundary = [NSString stringWithString:@"0xKhTmLbOuNdArY"]; contentType = [NSString stringWithFormat:@"multipart/form-data; boundary=%@", stringBoundary]; [urlRequest addValue:contentType forHTTPHeaderField:@"Content-Type"]; // Setting up the POST request's multipart/form-data body postBody = [NSMutableData data]; [postBody appendData:[[NSString stringWithFormat:@"\r\n\r\n--%@\r\n", stringBoundary] dataUsingEncoding:NSUTF8StringEncoding]]; [postBody appendData:[[NSString stringWithString:@"Content-Disposition: form-data; name=\"source\"\r\n\r\n"] dataUsingEncoding:NSUTF8StringEncoding]]; [postBody appendData:[[NSString stringWithString:@"lighttable"] dataUsingEncoding:NSUTF8StringEncoding]]; // So Light Table show up as source in Twitter post [postBody appendData:[[NSString stringWithFormat:@"\r\n--%@\r\n", stringBoundary] dataUsingEncoding:NSUTF8StringEncoding]]; [postBody appendData:[[NSString stringWithString:@"Content-Disposition: form-data; name=\"title\"\r\n\r\n"] dataUsingEncoding:NSUTF8StringEncoding]]; [postBody appendData:[[NSString stringWithString:book.title] dataUsingEncoding:NSUTF8StringEncoding]]; // title [postBody appendData:[[NSString stringWithFormat:@"\r\n--%@\r\n", stringBoundary] dataUsingEncoding:NSUTF8StringEncoding]]; [postBody appendData:[[NSString stringWithString:@"Content-Disposition: form-data; name=\"isbn\"\r\n\r\n"] dataUsingEncoding:NSUTF8StringEncoding]]; [postBody appendData:[[NSString stringWithString:book.isbn] dataUsingEncoding:NSUTF8StringEncoding]]; // isbn [postBody appendData:[[NSString stringWithFormat:@"\r\n--%@\r\n", stringBoundary] dataUsingEncoding:NSUTF8StringEncoding]]; [postBody appendData:[[NSString stringWithString:@"Content-Disposition: form-data; name=\"price\"\r\n\r\n"] dataUsingEncoding:NSUTF8StringEncoding]]; [postBody appendData:[[NSString stringWithString:txtPrice.text] dataUsingEncoding:NSUTF8StringEncoding]]; // Price [postBody appendData:[[NSString stringWithFormat:@"\r\n--%@\r\n", stringBoundary] dataUsingEncoding:NSUTF8StringEncoding]]; [postBody appendData:[[NSString stringWithString:@"Content-Disposition: form-data; name=\"condition\"\r\n\r\n"] dataUsingEncoding:NSUTF8StringEncoding]]; [postBody appendData:[[NSString stringWithString:txtCondition.text] dataUsingEncoding:NSUTF8StringEncoding]]; // Price NSString *imageFileName = [NSString stringWithFormat:@"photo.jpeg"]; [postBody appendData:[[NSString stringWithFormat:@"\r\n--%@\r\n", stringBoundary] dataUsingEncoding:NSUTF8StringEncoding]]; [postBody appendData:[[NSString stringWithFormat:@"Content-Disposition: form-data; name=\"upload\"; filename=\"%@\"\r\n",imageFileName] dataUsingEncoding:NSUTF8StringEncoding]]; //[postBody appendData:[[NSString stringWithFormat:@"Content-Disposition: form-data; name=\"upload\"\r\n\n\n"]dataUsingEncoding:NSUTF8StringEncoding]]; [postBody appendData:[@"Content-Type: image/jpeg\r\n\r\n" dataUsingEncoding:NSUTF8StringEncoding]]; [postBody appendData:imageData]; [postBody appendData:[[NSString stringWithFormat:@"\r\n--%@\r\n", stringBoundary] dataUsingEncoding:NSUTF8StringEncoding]]; // [postBody appendData:[[NSString stringWithFormat:@"\r\n--%@--\r\n", stringBoundary] dataUsingEncoding:NSUTF8StringEncoding]]; NSLog(@"postBody=%@", [[NSString alloc] initWithData:postBody encoding:NSASCIIStringEncoding]); [urlRequest setHTTPBody:postBody]; NSLog(@"Image data=%@",[[NSString alloc] initWithData:imageData encoding:NSASCIIStringEncoding]); // Spawn a new thread so the UI isn't blocked while we're uploading the image [NSThread detachNewThreadSelector:@selector(uploadingDataWithURLRequest:) toTarget:self withObject:urlRequest]; I the method uploadingDataWithURLRequest i post the request to the server... Here is my php Code ?php $title = $_POST['title']; $isbn = $_POST['isbn']; $price = $_POST['price']; $condition = $_POST['condition']; $image=$_FILES['image']['name']; if($image) { $filename = 'newimage.jpeg'; file_put_contents($filename, $image); echo "image is there"; } else { echo "image is nil"; } ?> I am unable to get the image on server kindly help me where i am wrong.

    Read the article

  • Cover flow model screen adjust in iphone

    - by abdulsamad
    Hi All, Below is the link for making the cover flow model in iphone. This is a sample tutorial. http://www.chaosinmotion.com/flowcover.m Can any one tell me how can i make the cover flow model to adjust some where up on the screen. Currently it is in the centre of the screen i want if about 70 to 80pixels to move up in the screen. Your help will be highly appreciated.

    Read the article

  • Cover flow model in iphone

    - by abdulsamad
    I am making the cover flow model on the iPhone using the tutorial found here: http://www.chaosinmotion.com/flowcover.m I want to move the cover flow animation up in the screen at height of about 150, but when I change the starting y point of the rectangle, then my image is cut off from the top. How can I prevent this?

    Read the article

  • php code for geeting paramenter and image from the post request

    - by abdulsamad
    Hi all can any one guide me how to get parameter specially image from the given post request. --0xKhTmLbOuNdArY Content-Disposition: form-data; name="source" lighttable --0xKhTmLbOuNdArY Content-Disposition: form-data; name="title" Google (The top search engine). --0xKhTmLbOuNdArY Content-Disposition: form-data; name="isbn" 9780077282073 --0xKhTmLbOuNdArY Content-Disposition: form-data; name="price" 5 --0xKhTmLbOuNdArY Content-Disposition: form-data; name="condition" Execlent --0xKhTmLbOuNdArY Content-Disposition: form-data; name="media" Content-Type: image/jpg Content-Transfer-Encoding: binary ÿØÿà NoTE:: ÿØÿà is the image in that request.

    Read the article

  • Performselector not call in NSThread

    - by abdulsamad
    Hi all, I have a problem that i want to call a function when one of my functions that is running into a seperate thread comes to an end. its like that [NSThread detachNewThreadSelector:@selector(fetchFeaturedFreeApps) toTarget:self withObject:nil]; here is my fetchFeaturedFreeApps function -(void)fetchFeaturedFreeApps { ////all my code [self performSelector:@selector(closeView) withObject:nil afterDelay:4.0]; } My problem is that the close view methods doesnt run after the 4 seconds. Hoew if i call the fetchFeaturedFreeApps method with perform selector then my closeview metod is called properly. Your valuable help is highly appreciated.

    Read the article

  • TableView reloading problem

    - by abdulsamad
    Hi All, i am in a very serious problem of tableview reloading. i have two option in my tableview 1) show next 10 Results 2) show previos 10 results I wanna show only 50 results at a time in my table view. when table is populated with 50 results after that on pressing "show next 10 results" the results from 1-10 are removed and results from 51-60 are now displayed and hence i have the total results in my table view from 11-60. As the total # of results remain 50 hence i have the cells with their identifier from 1-50 and now they are not nil. So i also have to code in else block of the condition if(cell == nil) { } else{ Have to write the same code as in if. } Now my cells are properly reloading on clicking "show next 10" and on clicking "show previous 10" but the problem is that because of the code in else block my cells are also reloaded when the user scrolls the table-view. Kindly give some good suggestion what should i do to get out from this situation.

    Read the article

  • Navigation problem with view controllers.

    - by abdulsamad
    Hi All I have some problem with the my view controllers. When i have about 50 or more records in one of my table view which is below in the stack of view controllers and if i tap the back button quickly the navigation bar on the tap changes but the view does't change. For example: if i have the search controller below in the stack and detail controller up in the stack in this case on tapping the back button quickly the navigation bar comes to the search but the view controller remains on detail page. can any one can give me cause or solution of this problem. your help will be highly appreciated.

    Read the article

1