Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9187647
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T19:49:29+00:00 2026-06-17T19:49:29+00:00

Hello I want to show you what I’m doing because my PHP or my

  • 0

Hello I want to show you what I’m doing because my PHP or my iOS is not sending the File to the FTP server :S

iOS side:

NSArray *dirPaths;
NSString *docsDir;
dirPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
docsDir = dirPaths[0];
NSString *nombreArchivo = @"wtthdb.db";

NSData *archivo = [NSData dataWithContentsOfFile:[[NSString alloc] initWithString: [docsDir stringByAppendingPathComponent:nombreArchivo]]];
NSLog(@"Tamaño del archivo %i",[archivo length]);

NSMutableString *post = [[NSMutableString alloc] initWithFormat:@"file=%@&filename=%@",archivo,nombreArchivo];
[post appendFormat:@"%@",archivo];
NSData *postData = [post dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES];

NSString *postLength = [NSString stringWithFormat:@"%d", [postData length]];
NSURL *url = [NSURL URLWithString:@"http://zsoft.es/subidaios.php"];
NSMutableURLRequest *peticion = [NSMutableURLRequest requestWithURL:url];

NSURLConnection *con;
@try
{
    [peticion setHTTPMethod:@"POST"];
    [peticion setValue:postLength forHTTPHeaderField:@"Content-Length"];
    [peticion setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
    [peticion setHTTPBody:postData];
    con = [NSURLConnection connectionWithRequest:peticion delegate:self];
    [con start];
}
@catch (NSException *e)
{
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error del servidor"
                                                    message:[NSString stringWithFormat:@"Error: %@",e]
                                                   delegate:self
                                          cancelButtonTitle:@"Aceptar"
                                          otherButtonTitles:nil];
    [alert show];
}
NSLog(@"Empezado");

And this is my PHP side:

  <?php
if (isset($_POST['name']) && isset($_POST['filename']))
{
    $name  = $_POST['name'];
    $filename  = $_POST['filename'];
    $ftp = ftp_connect("ftp.marinesignal.com");
    ftp_login($ftp, "user", "pass");
    ftp_pasv($ftp, true);
    ftp_put($ftp,$filename,$name,FTP_BINARY);
    ftp_close($ftp);
}
 ?>

And I don’t know how to debug via XCode my PHP code…

Thanks!!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T19:49:30+00:00Added an answer on June 17, 2026 at 7:49 pm

    I’d recommend you to go through this nice article on how to upload a UIImage to the web so you can get an idea on how to prepare and POST the file to the web

    http://zcentric.com/2008/08/29/post-a-uiimage-to-the-web/

    Then on your PHP Server side you should consider that files are delivered through the $_FILES global variable so you should handle them on this matter

    <?php
    $temporalFolder = "temporal/";
    
    $filePath = $temporalFolder . basename( $_FILES['uploadedfile']['name']); 
    
    if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $temporalFolder)) {
        echo "The file has been uploaded";
    } else{
        echo "There was an error uploading the file";
    }
    
    $name  = $_POST['name'];
    $ftp = ftp_connect("ftp.marinesignal.com");
    ftp_login($ftp, "user", "pass");
    ftp_pasv($ftp, true);
    ftp_put($ftp,$filePath,$name,FTP_BINARY);
    ftp_close($ftp);
    
    ?>
    

    Hope this can give you some insight on your issue

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hello I am using Apache Commons FTP Client and I want to show the
hello am trying to learn ftp file transfer in php. i have done all
Hello i want to show data from table where i have to show only
Hello I can't figure out why UIImageView doesn't want to show up in UIScrollView.
hello all i have my splash screen which i want to show in landscape
I have a paragraph <p>hello<br>wor&nbsp;l&nbsp;d</p> then I want show the paragraph's html in another
Hello I want to create a nice 3D scene to show some 3D models.
Hello guys I have a List that I want to show for all users
Hello this is my query. I want to show the titles of posts that
Hello i want to extract links <a href=/portal/clients/show/entityId/2121 > and i want a regex

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.