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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T11:02:22+00:00 2026-06-02T11:02:22+00:00

Okay, so I set up an upload engine for a website so that an

  • 0

Okay, so I set up an upload engine for a website so that an authenticated user can upload a audio file (a key) for a song in the library, but I come across this strange problem when I try to upload any file over 5MB.

I set my php.ini max filesize to 50MB by the way

Everything uploads properly, but there is no data associated with the file on the other end.

HTML CODE:

<form action="keyUpload.php?id=<?php echo $id;?>" method="post" enctype="multipart/form-data">
<p style="color:#fff;font-size:30px;font-family:Times">
Add a new Key:<br/><input name="uploaded" type="file" id="file"><br />
<input type="text" name="kname" id="kname" value placeholder="Key Name (Ex. Demo, A#, etc.)" style="width:300px;"><br/>
<button class="button">Upload File</button><br/>
<span style="font-size:12px;">*Max Filesize is 50 MB*</span>
</p>
</form>

PHP CODE:

<?php 
$id=$_GET["id"];
$name=$_POST["kname"];

$name = str_replace(" ","%20",$name);

$allowed_filetypes = array('.mp3','.m4a','.wav','.wma');

$filename = $_FILES['uploaded']['name'];
$ext = substr($filename, strpos($filename,'.'), strlen($filename)-1);

Both $filename and $ext are empty variables when I upload a file larger than 5 MB. In all other cases, this engine works perfectly.

When echoed, simply nothing happens, so obviously the engine will not save the file if it doesn’t exist. What’s going on?

var_dump:

array(0) { }

Thanks for all your help!

  • 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-02T11:02:29+00:00Added an answer on June 2, 2026 at 11:02 am

    Check for upload errors:

    if ($_FILES['uploaded']['error'] !== UPLOAD_ERR_OK) {
       die("Upload failed with error code " . $_FILES['uploaded']['error']);
    }
    

    The error codes are defined here: http://www.php.net/manual/en/features.file-upload.errors.php

    As well, do NOT use filenames to validate the uploads. It is beyond trivial for a malicious user to fake a filename and upload malicious files, eg.

    ren nastyvirus.exe good_tune.mp3
    

    And don’t use string operations on filenames. There’s a whole whack of PHP functions for filename manipulation, e.g. http://php.net/basename

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

Sidebar

Related Questions

Okay I have a JSON file and it has a set of objects that
Okay so is there a way to set a date that can be easily
Okay so i set up this thing so that I can print out page
Okay, so I have this form that is set to preload a DB record
Okay maybe i just need another set of eyes on this, but I have
Okay, often I'll have a method that returns a Set of some sort. The
Okay, so hopefully I am asking this question correctly: I set up my user
Okay, so we all know that most modern browsers (without tweaking) are set to
Okay so I've been set an assignment from university and I just can't get
Okay, so here's the idea; I want to create a set of icons that

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.