Lite mer kod...
/******Formuläret************
echo "<form action='adminBildArkiv.php?goTo=doAdd'
method='POST'>";//enctype='multipart/form-data'enctype='multipart/form-data' -Vill inte heller fungera!...
echo "<input type='hidden' name='MAX_FILE_SIZE' value='2000000'>";
echo "\<p\>Välj bild: \<input type='file' name='bild' size='25' class='textbild'\>\</p\>";
echo "\<p\>Bildtext:\</p\>\<textarea name='bildText'cols='10' rows='30' class='textinput'\>Bilden
föreställer...\</textarea\>\<br\>";
echo "\<p\>Bildens namn:\</p\>\<input type='text'class='rubrikinput' value='' name='bildNamn'\>";
echo "\<p\>Alternativ text:\</p\>\<input type='text' class='rubrikinput' value='' name='altText'\>";
echo "\<p\>\<br\>\<input name='submit' type='submit' value='Ok' class='submit'\> \<input name='reset'
type='reset' value='Ångra'class='submit'></p>";
echo "\</form\>";
*/
//****************************************************
//C:\Documents and Settings\Åsa\Skrivbord\avatar.jpg -sökvägen som visas i IE...
//*********** Felmeddelande i firefox ************
//Warning: filesize(): Stat failed for avatar.jpg (errno=2 - No such file or directory) in
//D:\dokument\Webbproduktion\flundra\php\bildArkivFunctions.php on line 119
//Warning: copy(avatar.jpg): failed to open stream: No such file or directory in
//D:\dokument\Webbproduktion\flundra\php\bildArkivFunctions.php on line 123
//***************************************************
function doAdd()
{
$this->bild = @$_POST['bild'];
$this-\>bildText = @$\_POST\['bildText'\];
$this-\>altText = @$\_POST\['altText'\];
$this-\>bildNamn = @$\_POST\['bildNamn'\];
$this-\>datum = $this-\>datum=date('Y-m-d');
$this-\>MAX_FILE_SIZE = @$\_POST\['MAX_FILE_SIZE'\];
Jag kör en echo för att kolla det som kommer från formuläret.
echo "$this->bild<br>$this->bildText<br>$this->altText<br>$this->datum<br> $this->MAX_FILE_SIZE";
$extention=explode(".",$this-\>bild);
$num=count($extention)-1;
//\*\*\*\*\*\*För att skapa ett unikt bildnamn \*\*\*\*\*\*\*\*\*\*\*
$this-\>randomName1=rand(1,500);
$this-\>randomName2=rand(7,300);
$this-\>randomName =$this-\>randomName1+$this-\>randomName2;
if($this-\>bildNamn=="")
{$this-\>bildNamn = "bild\_".$this-\>datum."\_".$this-\>randomName;
echo "\<h2\>Bildnamn: $this-\>bildNamn\</h2\>";
}
$imagename="img/bildbank/$this-\>bildNamn.$extention\[$num\]";
$this-\>bildnamn = $this-\>bildNamn.".".$extention\[$num\];
$this-\>size=filesize($this-\>bild);//kollar filstorleken
//echo "$imagename,$this-\>bild";
if($this-\>size\<$this-\>MAX_FILE_SIZE )
{
copy($this-\>bild,$imagename);// undarar varför det inte funkar i Firefox....
}
//***************************************************
//Här efter kommer lite databas kod men den fungerar!
//copy($this->bild,$imagename); verkar bara fungera i IE, alltså sökvägen till filen ,$this->bild, är inte
fulständig i Firefox...