Jump to content
Sign in to follow this  
piphansdk

Upload multiple files using html5 more than 8mb

Recommended Posts

Hello. For some weeks ago, i made a file upload for a gallery.I made it using html5, and everything works fine. the only problem is that when i select multiple files, the uploads funktion works fine when the total of all files is less than 8 mb, because of limitation on the php.I can se, that if i select more than 8mb, the files are uploaded to the server, but i dont think that the php can "move" the files at ones? Does any one have a work around? it is very important to select multiple files due to alot of sub_files! (i was thinking to make something like foreach file(upload and move)) sorry if this should have ben in php section :( //html//

<form action="send.php" method="post" enctype="multipart/form-data"><fieldset>  <legend>Upload af billeder</legend>		<?php$dirname = "Gallery";$dir = opendir($dirname);echo '<select name="sti">';echo '<option value="Vælg mappe!">Tryk her for at vælge galleri</option>';while(false != ($file = readdir($dir)))	{		if ($file<>'.' && $file<>'..')			{ if (is_dir("$file"));	echo "<option value=".$file.">$file</option>";			}	}			echo '</select>';	?> Vælg venligst det galleri du ænsker at uploade dine billeder til.	<br><br>Der kan maks uploades 8mb sammenlagt! Så hvis du ikke får en besked med at billederne er uploaded, har du nok valgt for mange!<br><br>	Vælg filer:<br>  <input type="file" value="" name="upload[]" multiple><br>  <button type="submit">Upload!</button>		</fieldset></form>

//php "send.php"//

<pre><?php	 $error_message[0] = "Dit forsøg på at uploade billederne lykkedes desværre ikke. <br>DU HAR IKKE VALGT EN MAPPE PRØV IGEN<br>Hvis du ikke har oprettet en mappe, kan du gøre det på upload siden.<br> hvis dette skulle være en fejl, er du velkommen til at skrive til mig. webadmin@domain<br>";$error_message[1] = "Filen du forsøger at uploade er er ALT for stort! du bedes forminske dit billede.";$error_message[2] = "Filen du forsøger at uploade er er ALT for stort! du bedes forminske dit billede.";$error_message[3] = "Kontakt administator: webadmin@domain vdr. fejl 3";$error_message[4] = "Du har ikke valgt nogen fil!";$upload_dir  = 'Gallery/'.$_POST['sti']."/";$num_files = count($_FILES['upload']['name']);for ($i=0; $i < $num_files; $i++) {	$upload_file = $upload_dir . rand(1000, 9999) . basename($_FILES['upload']['name'][$i]);	if (!preg_match("/(gif|jpg|jpeg|png|GIF|JPG|JPEG|PNG)$/",$_FILES['upload']['name'][$i])) {		print "Der kan kun uploaded billeder! dvs. ingen dokumenter eller PDF filer! Hvis du mener dette er en fejl, kontakt venligst admin: webadmin@domain";	} else {		if (@is_uploaded_file($_FILES['upload']['tmp_name'][$i])) {			if (@move_uploaded_file($_FILES['upload']['tmp_name'][$i],				$upload_file)) {				/* Great success... */				echo "Din fil er nu blevet uploaded til: " . $upload_file . "<br />";				echo "<--*done*--> <br>";			} else {				print $error_message[$_FILES['upload']['error'][$i]];			}		} else {			print $error_message[$_FILES['upload']['error'][$i]];		}   	}}echo "done";?></pre>

Edited by piphansdk

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...