Jump to content
php.lv forumi

upload & permisions


Blitz

Recommended Posts

Seit ir uplaod skripts.

 

$uploaddir = './images/sortiments/temp/';
  $uploadfile = $uploaddir . basename($_FILES['file'] ['name']);

  chmod($_FILES['file']['tmp_name'], 0777);

  echo substr(sprintf('%o', fileperms($_FILES['file']['tmp_name'])), -4);
  echo substr(sprintf('%o', fileperms($uploaddir)), -4);

  move_uploaded_file($_FILES['file']['tmp_name'], $uploadfile);

 

Seit outputs ko rada skripts.

 

0777
0755

Warning: move_uploaded_file(./images/sortiments/temp/armands_small.jpg) [function.move-uploaded-file]: failed to open stream: Permission denied in /home/s/spweb/public_html/new/add.php on line 34

Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phpcDdziq' to './images/sortiments/temp/armands_small.jpg' in /home/s/spweb/public_html/new/add.php on line 34

 

Tatad uploudojot failu, es vinam pieskiru permisions 0777, tad pec idejas vajadzetu vinu normali parkopet no temp direktorijas uz man vajadzigo. Tas pirmais errors liekas interesants. Cik saprotu vins rada ka failam (./images/sortiments/temp/armands_small.jpg) nav attiecigas permisions. Bet kaa lai es vians uzlieku ja reali tads fails neeksistee? Kur varetu vel but problema, nevaru saprast?

 

Direktoriju nosaukumi relativie, vide unix...

Link to comment
Share on other sites

nu pilniigi lieki ir

chmod($_FILES['file']['tmp_name'], 0777);

 

 

ir taa, ka to direktoriju, uz kuru aploudosi, Tavaa gadiijumaa "/images/sortiments/temp/" vajag chmod 777 un tad ieksh php, Tev ir veerts mainiit faila permisijas peec move_uploaded_file() izpildiishanaas.

 

move_uploaded_file($_FILES['file']['tmp_name'], $uploadfile);

chmod($uploadfile,755);

 

Tas uz dazhiem serveriem ir lieki, bet piemeeram serveris.lv hostingaa to vajag, lai peec tam vareetu exekuutot (atveert) bildi.

Link to comment
Share on other sites

Nja, es jau ari taa no sakuma domaju, bet kad meiginaju:

$uploaddir = './images/sortiments/temp/';
chmod($uploaddir, 0777);

tad

Warning: chmod() [function.chmod]: Operation not permitted in /home/s/spweb/public_html/new/add.php on line 28

 

un ja norada pilnu celju (/home/s/spweb/public_html/new/images/sortiments/temp/)

tad:

Warning: chmod() [function.chmod]: Operation not permitted in /home/s/spweb/public_html/new/add.php on line 28

Warning: fileperms() [function.fileperms]: SAFE MODE Restriction in effect. The script whose uid is 11385 is not allowed to access / owned by uid 0 in /home/s/spweb/public_html/new/add.php on line 31

 

Vai tiesham SAFE MODE natlautu mainit permisions mapeem, vai kautkur ir liikas rokas?

Link to comment
Share on other sites

Pameegjini caur kaadu ftp aplikaaciju, ja nevar, tad suuti adminim, ka tai un tai mapei permiicijas taadas un taadas, lai uzliek.

 

btw, taas permiicijas tik vienreiz uzliksi un viss, nav katreiz skriptaa jaachmodo folderis.

Edited by Kristabs
Link to comment
Share on other sites

×
×
  • Create New...