19. maj 2004 - 20:47Der er
25 kommentarer og 1 løsning
open_basedir restriction in effect
Hejsa Når jeg forsøger at uploade en fil får jeg følgende fejl:
open_basedir restriction in effect
Jeg har samme kode til at kører på en anden server og der virker det fint. Jeg tror at det har noget med safemode at gøre men hvordan gør jeg når det ikke er min server, så der er ikke mulighed for at slå safemode fra.
technodance.dk > Ja, men jeg tror nærmere det er hans dirs der er forkerte. Efter fejlmeddelelsen at bedømme virker det som om han prøver at få en ekstern dir fordi han har glemt at ændre den i koden.
/* 0024: * validateUpload(&$file,$attr,&$rc) .. 0025: * 0026: * &$file should be the array provided by php with 0027: * info about the uploaded file. 0028: * $attr is an hash-array containing options. (Option)Keys are: 0029: * max_file_size: 0030: * maximum allowed file size in bytes. If it dosnt exist, check is disabled 0031: * allowed_mimes: 0032: * is an array of accepted mimes-type. If it dosnt exist, check is disabled 0033: * max_image_width / max_image_height: 0034: * Max allowed width/height of pictures (jpg,png,gif) 0035: * image_scale: 0036: * If picture is larger than max_image_width/max_image_height should we try 0037: * to scale it down (keeping aspect) 0038: * output: 0039: * If this is an existing directory, the filename is appended, and is used for 0040: * storing the picture. If output isnt a directory, it is used 'as-is' for 0041: * storing the picture. 0042: * keep_extension: 0043: * If output is a filename, should we append the extension. (true/false) 0044: * allowed_mimes: 0045: * Accepted mime-types. Optional. If it dosnt exists, no limitated is enforced. 0046: * 0047: * &$rc: is a integer that contains status of the operatoin 0048: * VUPLOAD_OK (0) Every was fine 0049: * VUPLOAD_TOO_LARGE_BYTE (1) The file exceeded max_file_size configuration option. 0050: * VUPLOAD_WRONG_MIME (2) Uploaded file isnt allowed (didnt exists in allowed_mimes) 0051: * VUPLOAD_TOO_LARGE_PIXEL (3) Picture was too large (width/hight). 0052: * VUPLOAD_SCALE_FAILED (4) If scaling fails. 0053: * VUPLOAD_MOVE_FAILED (5) If moving from the temporary directory fails. 0054: * RETURNS: 0055: * filepath of stored file if success, otherwise null is returned 0056: */
function validateUpload(&$fileInfo,$attr,&$rc) { $file_moved = false;
// Check if file is large or not (byte-wise) if( isset($attr['max_file_size']) && $fileInfo['size'] > $attr['max_file_size'] ) { $rc = VUPLOAD_TOO_LARGE_BYTE; return null; }
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.