/    Sign up×
Community /Pin to ProfileBookmark

PHP Upload not working with spaces in filename?

I’ve got two servers, one works fine with spaces within the file upload. However, the other doesn’t?

What could this be?

to post a comment
PHP

6 Comments(s)

Copy linkTweet thisAlerts:
@callumdOct 02.2007 — This is an absolute guess..

Is it the operating system?

I know I had some trouble with some file names because one operating system on one server (I think it was Linux) was case sensitive, while Windows wasn't.

So the file:

pic1.PNG

Was not recognised on the Linux server if I referred to it as 'pic1.png', but Windows recognised it fine.
Copy linkTweet thisAlerts:
@gizmoOct 02.2007 — Windows will accept spaces in filenames, Linux requires %20 instead.
Copy linkTweet thisAlerts:
@sanchez_1960authorOct 03.2007 — Yep, both servers are running Linux but one will accept spaces while the other wont.
Copy linkTweet thisAlerts:
@MrCoderOct 03.2007 — One server running with safe_mode on and the other without?
Copy linkTweet thisAlerts:
@NightShift58Oct 03.2007 — Check your server settings...

I suspect one is automatically converting spaces to %20 while the other hasn't been told to do so...

You can use [b]urlencode()[/b] to force the conversion, regardless of server settings.
Copy linkTweet thisAlerts:
@rootOct 03.2007 — Depends on the server, usually Apache server truncates at first white space, so ensuring that your white space is treated correctly in the first place will prevent this from happening.

As NightShift has suggested, urlencode whatever is causing the issue.
×

Success!

Help @sanchez_1960 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.20,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...