Jump to content
php.lv forumi

foto upload(kārtējo reizi) :D


kalabox

Recommended Posts

nu taa ir kods luuk taads:

<form enctype="multipart/form-data" action="anketa.php" method="POST">

<input type="hidden" name="MAX_FILE_SIZE" value="100000" />

Choose a file to upload: <input name="uploadedfile" type="file" /><br />

<input type="submit" value="Upload File" />

</form>

<?php

$target_path = "uploads/";

 

$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);

 

if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {

echo "The file ". basename( $_FILES['uploadedfile']['name']).

" has been uploaded";

} else{

echo "There was an error uploading the file, please try again!";

}

?>

 

 

unvins man tikai saglabā bildes uploads direktorijā, kā lai es dabonu, ka man tās bildes attēlo uz bildes.php ?????

Link to comment
Share on other sites

Man arī sanāca izdarīt tā lai bildes pievienojas piem. bildes.php

<?php

if ($handle = opendir('bildes/')) {

while (false !== ($file = readdir($handle))) {

if (strlen($file) > 4)

{

echo "<center><img src=\"bildes/$file\"></center>";

}

}

closedir($handle);

}

?>

Vienīgais pa tiem izmēriem nez! :/

Link to comment
Share on other sites

Man vis smuki sanāca!

<?php

if ($handle = opendir('bildes/')) {

while (false !== ($file = readdir($handle))) {

if (strlen($file) > 4)

{

echo "<center><a href=bildes/$file><img src=\"bildes/$file\" border=1 width=163 height=201></a></center>";

}

}

closedir($handle);

}

?>

P.S. Tos width & height vari izlabot. :)

Link to comment
Share on other sites

Piemēram rekur atradu smuku kodiņu bilžu palielināšanai.. POPup logu automātiski samazina vai palielina..

 

viss ir ok, tikai neparāda tajā logā biuldi..

 

 

<?php

if ($handle = opendir('uploads/')) {

while (false !== ($file = readdir($handle))) {

if (strlen($file) > 4)

{

echo "<img src=\"uploads/$file\" border=0 width=120 height=160><a href=java script:CaricaFoto('uploads/$file')>Palielināt</a>";

}

}

closedir($handle);

}

?>

<script LANGUAGE="JavaScript">

 

<!-- Begin

function CaricaFoto(img){

foto1= new Image();

foto1.src=(img);

Controlla(img);

}

function Controlla(img){

if((foto1.width!=0)&&(foto1.height!=0)){

viewFoto(img);

}

else{

funzione="Controlla('"+img+"')";

intervallo=setTimeout(funzione,20);

}

}

function viewFoto(img){

largh=foto1.width+20;

altez=foto1.height+20;

stringa="width="+largh+",height="+altez;

finestra=window.open(img,"",stringa);

}

// End -->

</script>

 

-------------------------------------

Noteikti tas java chakaree visu..?

----------------------

while (false !== ($file = readdir($handle))) {

tieshi taa vieta "!==" cik zinu no C++ un C# valodas ir jaabuut "!=" nevis "!=="

 

vai ne???

Edited by kalabox
Link to comment
Share on other sites

Nu un ? Praktiski visās valodās ir tāds operators.

 

Nezinu, bet domāju, ka C++ nav tik pieļāvīgs uz mainīgo tipu nedefinēšanu, tāpēc domāju, ka C++ != strādā apt. tāpat kā PHP !==, bet nu ļoti iespējams, ka meloju, jo no C++ vispār neko nesaprotu :).

Link to comment
Share on other sites

×
×
  • Create New...