Zoom Posted April 5, 2005 Report Share Posted April 5, 2005 Kadas funkcijas man vaidzetu zinat, lai es varetu weba uploaudot bildes ? ja nesapratat labs piemers: foto.inbox.lv Link to comment Share on other sites More sharing options...
tamster Posted April 5, 2005 Report Share Posted April 5, 2005 http://lv.php.net/manual/en/features.file-upload.php nu un, droši vien, ar GD saistītās f-cijas (resaizošanai). Link to comment Share on other sites More sharing options...
Toms Posted April 5, 2005 Report Share Posted April 5, 2005 (edited) uploadeeshanai vienaa suudiigaa vietaa es izmantoju shaadu (nevisai smuku funkciju): function UploadFile($inputfield_name,$upload_dir,$max_size){ $upload_file = $upload_dir.$_FILES[$inputfield_name]['name']; if (($_FILES[$inputfield_name]['size'] <= $max_size) && ($_FILES[$inputfield_name]['size'] != 0)) @move_uploaded_file($_FILES[$inputfield_name]['tmp_name'], $upload_file); } un HTML: <form enctype="multipart/form-data" method="POST"> Pievienot failu (max: 2MB): <input name="userfile" type="file" size="16"> <input type="submit" name="upload_file" value="Pievienot"> </form> un peec "Pievienot" nospieshanas: if ($_POST['upload_file']){ if ($_FILES['userfile']['size'] > 2097152){ echo 'Fails par lielu! Maksimums: 2 MB'; } else{ UploadFile('userfile',$dir,'2097152'); // 2MB header('Location: index.php?dir='.$dir); } } Shitaas nav smukas lietas, bet nu man slinkums uzlabot, kameer klients (bratella) nesuudzaas, tikmeer labi! :) Protams, tamster arii paklausi! Edited April 5, 2005 by Toms Link to comment Share on other sites More sharing options...
Recommended Posts