0

i have a code


Index.php

<script src='jquery.js' type="text/javascript"></script>
<script src='documentation.js' type="text/javascript"></script>
<link href='documentation.css' type="text/css" rel="stylesheet"/>
<script src='jquery.form.js' type="text/javascript" language="javascript"></script>
<script src='jquery.MetaData.js' type="text/javascript" language="javascript"></script>
<script src='jquery.MultiFile.js' type="text/javascript" language="javascript"></script>
<script src='jquery.blockUI.js' type="text/javascript" language="javascript"></script>
<script src="http://digg.com/tools/diggthis.js" type="text/javascript"></script>
<script type="text/javascript"><!--
google_ad_client = "pub-9465008056978568";
google_ad_slot = "4176621808";
google_ad_width = 120;
google_ad_height = 600;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>





      <script type="text/javascript">
      <!-- Begin
      /* This script and many more are available free online at
        The JavaScript Source!! http://javascript.internet.com
         Created by: Abraham Joffe :: http://www.abrahamjoffe.com.au/ */
      /***** CUSTOMIZE THESE VARIABLES *****/
      // width to resize large images to
      var maxWidth=500;
      // height to resize large images to
      var maxHeight=500;
      // valid file types
      var fileTypes=["bmp","gif","png","jpg","jpeg"];
      // the id of the preview image tag
      var outImage="previewField";
      // what to display when the image is not valid
      var defaultPic="spacer.gif";
      /***** DO NOT EDIT BELOW *****/
      function preview(what){
      var source=what.value;
      var ext=source.substring(source.lastIndexOf(".")+1,source.length).toLowerCase();
     for (var i=0; i<fileTypes.length; i++){
      if (fileTypes[i]==ext){
      break;
      }
      }
      globalPic=new Image();
        if (i<fileTypes.length){  
     //Obtenemos los datos de la imagen de firefox
      try{
    globalPic.src=what.files[0].getAsDataURL();
      }catch(err){
        globalPic.src=source;
      }
       }else {
       globalPic.src=defaultPic;
       alert("Format error:nn"+fileTypes.join(", "));
      }
      setTimeout("applyChanges()",200);
      }
      var globalPic;
       function applyChanges(){
      var field=document.getElementById(outImage);
      var x=parseInt(globalPic.width);
      var y=parseInt(globalPic.height);
      if (x>maxWidth) {
      y*=maxWidth/x;
      x=maxWidth;
      }
      if (y>maxHeight) {
      x*=maxHeight/y;
      y=maxHeight;
      }
      field.style.display=(x<1 || y<1)?"none":"";
      field.src=globalPic.src;
      field.width=x;
      field.height=y;
      }
      // End -->
      </script>
        <body><div align="center" style="line-height: 1.9em;">
      <br>
      
      
      <form action="upload.php" method="POST" enctype="multipart/form-data">
    
         <input type="file" id="picField" class="multi"  name="pictures[]" maxlength="3"  onchange="preview(this)"/>
         
    <input name="submite" type="submit">
      
</form>

      
      
      <br>
      <img alt="Graphic will preview here" id="previewField" src="../style/No_imge.jpg">
      </div></body>
     <br>

Upload.php

<?php
move_uploaded_file($_FILES["pictures"]["tmp_name"],$_FILES["pictures"]["name"]) or die("Problems with upload");
?>

The upload code is giving error :9 can somwan help please :|

Edited by dan1992: n/a

3
Contributors
5
Replies
7
Views
6 Years
Discussion Span
Last Post by dan1992
0

After submitting the form it is submitted to 'upload.php' so your

move_uploaded_file($_FILES["pictures"]["tmp_name"],$_FILES["pictures"]["name"]) or die("Problems with upload");

code should be in that page.

0

you don't understand this is a multi upload form .. and I get error on "move_uploaded_file" ......

0

Ok ok calm down, try this code.
Good luck cos I haven't tested it.

$tname = $_FILES["pictures"]["tmp_name"];
$name = $_FILES["pictures"]["name"];
foreach($tname as $key => $value)
{
	move_uploaded_file($_FILES["pictures"]["tmp_name"]["$key"],$_FILES["pictures"]["name"]["$key"]) or die("Problems with upload");
}
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.