/    Sign up×
Community /Pin to ProfileBookmark

Help with image uploading

Hi,
i’m trying to make a form with an upload field, i’ve set the max_file_size to 100mb, but it doesn’t seem to work, i can only upload files with a very small size.

form:

[code=html]
<form enctype=”multipart/form-data” method=”POST” action=”insert_to.php”>
<input type=”hidden” name=”MAX_FILE_SIZE” value=”100000″>
Choose a file to upload<br>
<input size=70 name=”cimage” type=”file”>
<input type=”submit” value=”Add new item” name=”addnew”>
[/code]

php:?

[code=php]
//upload file
$path_to =”images/”;
$file_name =basename($_FILES[‘cimage’][‘name’]);
$file_to =$path_to.$file_name;
$file_temp =$_FILES[‘cimage’][‘tmp_name’];

$res2=move_uploaded_file($file_temp,$file_to);
if($res2) {
echo “<p><strong>Image:</strong><br><br><img border=”0″ src=”$file_to”></p>”;
}
else {
echo ”
There was an error uploading the image, please try again!<br>”;
}

[/code]

I’ve tried searching for the solution and everyone seems to mention some kind of max file size, but i have no idea how to implement it into the codes ? could someone please help me shed some light?

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@NogDogAug 25.2009 — <i>
</i>&lt;input type="hidden" name="MAX_FILE_SIZE" value="[COLOR="Red"][B]100000[/B][/COLOR]"&gt;

That is 100,000 [b]bytes[/b]. For 100 MB you need 3 more zeros: "100000000".
Copy linkTweet thisAlerts:
@m5884authorAug 25.2009 — thank you...i'm abit embarrassed now :o
×

Success!

Help @m5884 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 4.29,
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,
)...