/    Sign up×
Community /Pin to ProfileBookmark

Can’t up load file in Safari using php

Hi, I am not sure if the is really the place for this question.

I am testing a website, it has a place for visitor to upload file, the snippet I got, (I forgot where come from,) works well on almost every browser, IE 6 and 7, Safari for Windows, FF 3 for Mac and Windows. But for some reasons it doesn’t work on Safari 3.1.1 for Mac. I am wondering if it happen to somebody else as well.

Here is the front end:

<form action=”upload.php” method=”post” ENCTYPE=”multipart/form-data”>
File: <input type=”file” name=”file” size=”30″>
<input type=”submit” value=”Upload!”>
</form>

and the back end:

<?php

// ==============

// Configuration

// ==============

$uploaddir = “uploads”;

// Where you want the files to upload to

//Important: Make sure this folders permissions (CHMOD) is 0777!

// ==============

// Upload Part

// ==============

if(is_uploaded_file($_FILES[‘file’][‘tmp_name’]))
{
move_uploaded_file($_
FILES[‘file’][‘tmp_name’],$uploaddir.’/’.$_FILES[‘file’][‘name’]);
print “Your file has been uploaded successfully! Yay!”;
}
else
{
print “Your file has not been uploaded! Pleas try again!”;
}
?>

If someone knows what happens and how to correct it, I will really appreciate it.

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@SheldonJun 24.2008 — Try making the ENCTYPE lowercase.

Also, your up-loader will allow any types of files. That is a huge security issue with this code.
Copy linkTweet thisAlerts:
@MacPCauthorJun 24.2008 — Wow man, once I changed it to lower case it works. :p . Why is that ? Safari for Mac is more strict about case sensitivity?

Also, I will put in the file type filter.

Thanks so much.
×

Success!

Help @MacPC 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.3,
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: @Yussuf4331,
tipped: article
amount: 1000 SATS,

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

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...