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 6133151
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T17:11:28+00:00 2026-05-23T17:11:28+00:00

It seems i have solved the first in a set of problems with my

  • 0

It seems i have solved the first in a set of problems with my code. The question I am talking about is this one: First Question. As you can see the given answer is only about the objective-c code. This appears to be working correctly right now.

The problem seems to be the php code not finding the file as $HTTP_POST_FILES['mainfile']['name'] returns null. I’m not sure if the problem lies within the php code or the objective-c code. Both are below:

Objective-C code

NSString *theUrl = @"MyServerURL";//Sorry not showing this:)
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:[NSURL URLWithString:theUrl]];

[request setFile:[soundFileURL path] forKey:@"mainfile"];
[request startSynchronous];

PHP code

$SafeFile = $HTTP_POST_FILES['mainfile']['name'];

$uploaddir = "uploads/";
$path = $uploaddir.$SafeFile;
$mainfile = $HTTP_POST_FILES['mainfile'];

$toWrite .= "\nThe path to which the file should be saved = " . $path . "\n";

if($mainfile != null){ //AS LONG AS A FILE WAS SELECTED...
    $toWrite .= "The file is NOT NONE!\n";

    if(copy($HTTP_POST_FILES['mainfile']['tmp_name'], $path)){ //IF IT HAS BEEN COPIED...
        $toWrite .= "The file was succesfully saved to the server! \n";
    }
}

This $toWrite variable gets written to a txt file. In this file i can see that at the first $toWrite the $SafeFile seems to be empty. This led me to beleve that the file is not accessable or not sent at all..

If anyone can help me figure out this problem I would be most thankfull!

  • 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-05-23T17:11:29+00:00Added an answer on May 23, 2026 at 5:11 pm

    ['name'] can be empty. It’s not required that uploaded files cary a filename= value. And regardless of that you should never use it unfiltered, as that opens the door to path traversal exploits.

    Your second problem might be the use of $HTTP_POST_FILES, which was valid in PHP4. Nowadays that array is called $_FILES. To see if your upload succeeded at all and what descriptive fields are present, test with print_r($_FILES); before you try anything else.

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

Sidebar

Related Questions

This seems to have been asked before: rails decimal precision and scale But when
PowerBuilder seems to have some support for plug-ins since version 10. However, I can't
Suppose I have a big database, about 800 tables. In this database there is
First: This is not a repeat of this question . Same script, but different
Im a new user in stackoverflow and this is my first question hope i
First of all, I have read the similar posts and don't see how they
Is my second question on this topic today but on the previous one it
I have a simple data model and I am using EF4.1 code first (but
This seems like a really amateur question, in my opinion, but nonetheless it's still
I have an EF code-first generated database. Data manipulation is done using DbContext .

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.