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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T14:58:30+00:00 2026-06-18T14:58:30+00:00

I have a website that allows users to upload a file. when uploading the

  • 0

I have a website that allows users to upload a file. when uploading the file on another page users can download that file. the problem is if the file name has a space in it will only pick up the first work not the whole file name. i was wondering is there a way to download the file with spaces in it or an easy option might be to add underscores to the file name so that it can be downloaded.

 //This is the directory where images will be saved 
 $target = "../images/avatars/"; 
 $target = $target . basename($_FILES['photoLocation']['name']);

// Check to see all fields have been completed
$photoLocation =($_FILES['photoLocation']['name']);

if (!empty($photoLocation))
{

    // Create an SQL query to add the comment
    $sql = "INSERT INTO tblPhotoUpload (photoLocation) VALUES ('$photoLocation')";



    // Connect to the database
    connect();

    // Run the query and store the result in a variable
    $result = mysql_query($sql) or die("Could not run query");


    //Writes the photo to the server 
    if(move_uploaded_file($_FILES['photoLocation']['tmp_name'], $target))

    // Close connection to the database
    mysql_close()

And i am displaying the file like this.

while($record = mysql_fetch_array( $result )) 
 { 
 ?> 

 <tr class="row">
    <td class="cell"><a href= http://xxxxxxxxxxxxxxxxxxxxxx.com/images/avatars/<?php         echo $record["photoLocation"];?>>Download</a> </td>
  • 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-18T14:58:31+00:00Added an answer on June 18, 2026 at 2:58 pm

    str_replace()

    $file= str_replace(‘ ‘,’_’,$file);

    or in your case :

    $target = $target . basename(str_replace(' ','_',$_FILES['photoLocation']['name']));
    
    $photoLocation =(str_replace(' ','_',$_FILES['photoLocation']['name']));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a mobile website that allows users to upload photos using the file
I currently have a website (ASP.NET 3.5, IIS 7.0) that allows users to upload
I have a website and a sub-domain that allows users to upload images to
I have a website that allows users to upload videos to it, After they
I have a client WordPress website that allows users to upload custom artwork from
I have recently created a website that allows users to upload images and then
I have a website that allows a user to upload a spreadsheet of items
I have a CMS website written in aspx 2.0 that allows users to build
I have an entries controller that allows users to add contact information the website.
So basically I have website that has names of cities that can be checked

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.