Dsy Network www | forum | my | didattica | howto | wiki | el goog | stats | blog | dona | rappresentanti
Homepage
 Register   Calendar   Members  Faq   Search  Logout 
.dsy:it. : Powered by vBulletin version 2.3.1 .dsy:it. > Community > Tech > [PHP] Problema cancellazione file
Pages (2): [1] 2 »   Last Thread   Next Thread
Author
Thread    Expand all | Contract all    Post New Thread    Post A Reply
Collapse
dan
..: Dottore :..

User info:
Registered: Oct 2002
Posts: 2446 (0.30 al dì)
Location: MI
Corso: Info
Anno: 3
Time Online: 11 Days, 7:56:39 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged
[PHP] Problema cancellazione file

Ciao a tutti, ho un problema con la funzione PHP unlink che dovrebbe consentire di cancellare un file.
Se gli passo direttamente l'indirizzo del file me lo cancella ma se lo metto in una variabile e gli passo quella... non mi cancella niente!

Come fate voi quando dovete cancellare un file?

Grazie.

15-03-2005 08:45
Click Here to See the Profile for dan Click here to Send dan a Private Message Visit dan's homepage! Find more posts by dan Add dan to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
Napolux
-29 Kg da Settembre 2005

User info:
Registered: Jun 2002
Posts: 3666 (0.44 al dì)
Location: Giussano (MI)
Corso: F28
Anno: ???
Time Online: 21 Days, 19:29:36 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

unlink("nome del file") occhio che non sia un indirizzo remoto ma locale ES. unlink("pippo.exe")

Cmq leggi http://it.php.net/unlink

__________________
Napolux.com

15-03-2005 08:54
Click Here to See the Profile for Napolux Click Here to See the Blog of Napolux Click here to Send Napolux a Private Message Visit Napolux's homepage! Find more posts by Napolux Add Napolux to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
dan
..: Dottore :..

User info:
Registered: Oct 2002
Posts: 2446 (0.30 al dì)
Location: MI
Corso: Info
Anno: 3
Time Online: 11 Days, 7:56:39 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Se faccio unlink("pippo.exe") funziona ma se faccio unlink($addr) dove $addr vale pippo.exe NO....

PERCHE'!!! :(

15-03-2005 08:59
Click Here to See the Profile for dan Click here to Send dan a Private Message Visit dan's homepage! Find more posts by dan Add dan to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
Bloody
ex universitaria

User info:
Registered: Jan 2003
Posts: 1939 (0.24 al dì)
Location: milano trasferta
Corso: informatica
Anno: dottora :)
Time Online: 49 Days, 2:18:48 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

nemmeno se metti la variabile tra singoli apici?
'$addr'

__________________
I don't care if you're black, white, straight, bisexual, gay, lesbian, short, tall, fat, skinny, rich or poor. If you're nice to me, I'll be nice to you. Simple as that.

15-03-2005 09:14
Click Here to See the Profile for Bloody Click Here to See the Blog of Bloody Click here to Send Bloody a Private Message Find more posts by Bloody Add Bloody to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
dan
..: Dottore :..

User info:
Registered: Oct 2002
Posts: 2446 (0.30 al dì)
Location: MI
Corso: Info
Anno: 3
Time Online: 11 Days, 7:56:39 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

ho già provato ma... niente

qualche idea?

15-03-2005 09:26
Click Here to See the Profile for dan Click here to Send dan a Private Message Visit dan's homepage! Find more posts by dan Add dan to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
Napolux
-29 Kg da Settembre 2005

User info:
Registered: Jun 2002
Posts: 3666 (0.44 al dì)
Location: Giussano (MI)
Corso: F28
Anno: ???
Time Online: 21 Days, 19:29:36 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

$addr = "pippo.exe" l'hai provato???

__________________
Napolux.com

15-03-2005 09:37
Click Here to See the Profile for Napolux Click Here to See the Blog of Napolux Click here to Send Napolux a Private Message Visit Napolux's homepage! Find more posts by Napolux Add Napolux to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
DeepBlue
tired guy

User info:
Registered: Sep 2003
Posts: 4258 (0.54 al dì)
Location: CSN
Corso: Info tlc
Anno:
Time Online: 52 Days, 8:40:31 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged
Re: [PHP] Problema cancellazione file

Originally posted by dan
ma se lo metto in una variabile e gli passo quella... non mi cancella niente!

Glielo passi lcoalmente o attraverso un form?

Nel secondo caso, potrebbe essere un "problema" di register_globals.

__________________
~ get Debian! ~ get FreeBSD! ~ get OpenBSD! ~

15-03-2005 13:28
Click Here to See the Profile for DeepBlue Click Here to See the Blog of DeepBlue Click here to Send DeepBlue a Private Message Find more posts by DeepBlue Add DeepBlue to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
dan
..: Dottore :..

User info:
Registered: Oct 2002
Posts: 2446 (0.30 al dì)
Location: MI
Corso: Info
Anno: 3
Time Online: 11 Days, 7:56:39 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

La cosa strana è che se faccio:


echo "./img/".$avatarpath."";
if(file_exists("./img/".$avatarpath.""))
{
echo "il file esiste!!!!";
unlink("./img/".$avatarpath."");
}
else
{
echo 'il file non esiste';
}


Mi visualizza il percorso dell'immagine ma poi mi dice che non esiste!
Com'è possibile???

15-03-2005 15:49
Click Here to See the Profile for dan Click here to Send dan a Private Message Visit dan's homepage! Find more posts by dan Add dan to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
DeepBlue
tired guy

User info:
Registered: Sep 2003
Posts: 4258 (0.54 al dì)
Location: CSN
Corso: Info tlc
Anno:
Time Online: 52 Days, 8:40:31 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Prova ad usare il path completo di dove si trova il file.

Come sei messo con i permessi su quel file?

__________________
~ get Debian! ~ get FreeBSD! ~ get OpenBSD! ~

15-03-2005 19:19
Click Here to See the Profile for DeepBlue Click Here to See the Blog of DeepBlue Click here to Send DeepBlue a Private Message Find more posts by DeepBlue Add DeepBlue to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
yeah
.grande:maestro.

User info:
Registered: Nov 2003
Posts: 1644 (0.21 al dì)
Location: Cologno Monzese
Corso: Informatica Magistrale
Anno: II
Time Online: 12 Days, 21:36:41 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Fai due cose:
1) metti error_reporting(E_ALL); da qualche parte, meglio all'inizio, del codice PHP, comunque prima dell'unlink()
2) Controlla il valore di ritorno della chiamata a unlink()

Originally posted by dan


Mi visualizza il percorso dell'immagine ma poi mi dice che non esiste!

Beh te lo visualizza perchè lo passi a echo() :)

Tanto per andare sul sicuro, togli il '.' all'inizio del path del file che vuoi cancellare e vedi se funziona.

__________________
?

15-03-2005 21:00
Click Here to See the Profile for yeah Click here to Send yeah a Private Message Find more posts by yeah Add yeah to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
Teju
:L'anti - anti-global!!:

User info:
Registered: Dec 2001
Posts: 1394 (0.16 al dì)
Location: Cassina Beach
Corso: Info
Anno: 3° ...circa...
Time Online: 5 Days, 8:26:35 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Originally posted by DeepBlue
Come sei messo con i permessi su quel file?

__________________
Teju.it - Una vita da raccontare

16-03-2005 23:49
Click Here to See the Profile for Teju Click Here to See the Blog of Teju Click here to Send Teju a Private Message Visit Teju's homepage! Find more posts by Teju Add Teju to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
dan
..: Dottore :..

User info:
Registered: Oct 2002
Posts: 2446 (0.30 al dì)
Location: MI
Corso: Info
Anno: 3
Time Online: 11 Days, 7:56:39 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

---

Last edited by dan on 17-03-2005 at 12:17

17-03-2005 12:13
Click Here to See the Profile for dan Click here to Send dan a Private Message Visit dan's homepage! Find more posts by dan Add dan to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
DeepBlue
tired guy

User info:
Registered: Sep 2003
Posts: 4258 (0.54 al dì)
Location: CSN
Corso: Info tlc
Anno:
Time Online: 52 Days, 8:40:31 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Originally posted by dan
---

Questi sarebbero i permessi??

mmm....fai un chmod 766, o 765 :)

__________________
~ get Debian! ~ get FreeBSD! ~ get OpenBSD! ~

17-03-2005 12:31
Click Here to See the Profile for DeepBlue Click Here to See the Blog of DeepBlue Click here to Send DeepBlue a Private Message Find more posts by DeepBlue Add DeepBlue to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
dan
..: Dottore :..

User info:
Registered: Oct 2002
Posts: 2446 (0.30 al dì)
Location: MI
Corso: Info
Anno: 3
Time Online: 11 Days, 7:56:39 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Il problema era nel DB: il campo in cui c'era l'indirizzo dell'immagine deve essere VARCHAR e non TEXT! :wall:

17-03-2005 13:31
Click Here to See the Profile for dan Click here to Send dan a Private Message Visit dan's homepage! Find more posts by dan Add dan to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
Napolux
-29 Kg da Settembre 2005

User info:
Registered: Jun 2002
Posts: 3666 (0.44 al dì)
Location: Giussano (MI)
Corso: F28
Anno: ???
Time Online: 21 Days, 19:29:36 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Originally posted by dan
Il problema era nel DB: il campo in cui c'era l'indirizzo dell'immagine deve essere VARCHAR e non TEXT! :wall:


Miiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii potevi dircelo prima! :D

__________________
Napolux.com

17-03-2005 13:59
Click Here to See the Profile for Napolux Click Here to See the Blog of Napolux Click here to Send Napolux a Private Message Visit Napolux's homepage! Find more posts by Napolux Add Napolux to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
All times are GMT. The time now is 23:45.    Post New Thread    Post A Reply
Pages (2): [1] 2 »   Last Thread   Next Thread
Show Printable Version | Email this Page | Subscribe to this Thread | Add to Bookmarks

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is ON
 

Powered by: vBulletin v2.3.1 - Copyright ©2000 - 2002, Jelsoft Enterprises Limited
Mantained by dsy crew (email) | Collabora con noi | Segnalaci un bug | Archive | Regolamento | Licenze | Thanks | Syndacate
Pagina generata in 0.109 seconds (68.28% PHP - 31.72% MySQL) con 22 query.