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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T14:51:47+00:00 2026-05-27T14:51:47+00:00

I’m having an issue where the path of my file upload isn’t being assigned

  • 0

I’m having an issue where the path of my file upload isn’t being assigned to the correct folder. It actually amends the file path to the file name of the file being uploaded. Weird right? Here’s the code I’m working on…

<?php
      $allowed_filetypes = array('.mp4','.gif','.bmp','.png','.html','.psd','.zip','.xml','.css','.js',);
      $max_filesize = 5904288;
      $upload_path = 'video';

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

   if(!in_array($ext,$allowed_filetypes))
      die('Sorry, cannot take files over blankKB.');

   if(filesize($_FILES['userfile']['tmp_name']) > $max_filesize)
      die('Sorry, cannot take files over blankKB.');

   if(!is_writable($upload_path))
     die('We are very sorry, a problem is occurring with the CHMOD  of this directory');

   if(move_uploaded_file($_FILES['userfile']['tmp_name'],$upload_path . $filename))
         echo ' Your file was uploaded successfully, view it <a href="file.php?file=' . $filename . '" target="_blank" title="Your File">here</a>';
      else
         echo 'Sorry, but there was an error during the file upload. Please try again.';
?> 

Here’s what the file looks like after being uploaded,

videoHello.png

plus it doesn’t upload the file to the directory I want it in, located at /video

  • 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-27T14:51:48+00:00Added an answer on May 27, 2026 at 2:51 pm

    When you write $upload_path . $filename you are only concatenating the two strings, which does indeed result in videoHello.png;

    You should either concatenate your system’s directory separator (On Unix based systems it’s /)

    $upload_path . '/' . $filename
    

    or build the separator into your string $upload_path

    $upload_path = 'video/';
    

    Though my final advice would be to use Absolute Paths like this:

    $upload_path = dirname(__FILE__) . '/video/';
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I have just tried to save a simple *.rtf file with some websites and
I want use html5's new tag to play a wav file (currently only supported
In my XML file chapters tag has more chapter tag.i need to display chapters
I am trying to render a haml file in a javascript response like so:
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.

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.