Home › Forum › Plugin e temi di WP › Upload file zip in articolo/pagina
-
AutorePost
-
-
15 Settembre 2013 alle 17:34 #25472marleyPartecipante
Salve, ho cercato sia in rete sia sul forum, ma oltre a trovare articoli di 6 anni fa, non ho trovato una risposta soddisfacente al mio problema.
Come da titolo vorrei fare in modo che l’autore di articoli possa caricare un qualsiasi file (zip / rar / pdf…) in una pagina/articolo.
oltre che ai plugin (che non ho trovato) non c’è un modo per aggirare la protezione e forzare l’upload del file nel “media” tramite php ?
uso la versione WP 3.6
Grazie a chi mi possa aiutare
-
15 Settembre 2013 alle 17:38 #106231wollyAmministratore del forum
-
16 Settembre 2013 alle 9:04 #106236marleyPartecipante
Grazie! Velocissimo ! mi era sfuggito questo tipo di ricerca, infatti ora sono andato a vedere come ricerca “media library” e mi escono risultati simili
Ma comunque non riesco, forse perché non mi è chiaro dove posizionarlo;
Cioè, all’inizio dice di copiare il codice nel functions.php del tema, ok, (uso twentyten)ma mi da errore di sintassi… dove debbo posizionarlo? all’inizio, alla fine, in mezzo (ci ho provato, ma mi da errore)
Stessa cosa questo link:
http://sjoerdkoelewijn.nl/2012/10/disable-file-types-in-wordpress/
non mi dice dove inserire il codice… mi potresti aiutare?
Intanto ho trovato questo plugin “WP-Filebase” ma se riuscissi a risolverlo tramite codice e senza plug in
-
16 Settembre 2013 alle 13:16 #106241marleyPartecipante
Ok, ce l’ho fatta!
Vi rendo partecipi sulla soluzione, per caso qualcun altro abbia lo stesso problema.
Ho semplicemente inserito nel wp-config.php questa stringa:
define('ALLOW_UNFILTERED_UPLOADS', true);
Grazie comunque a wolly -
16 Settembre 2013 alle 14:17 #106243wollyAmministratore del forum
La soluzione che hai scelto NON è sicura, permette di caricare qualsiasi cosa, anche virus.
-
16 Settembre 2013 alle 14:28 #106244marleyPartecipante
La soluzione che hai scelto NON è sicura, permette di caricare qualsiasi cosa, anche virus.
Ah…. Ma penso che non posso ovviare a questo problema visto che l’utente (collaboratore) deve necessariamente caricare file zip negli articoli
Oppure c’è una soluzione?
-
16 Settembre 2013 alle 16:56 #106245elmaniseroPartecipante
1° I temi di default non si modificano mai ma si deve usare un child theme
2° I file pdf si possono caricare senza bisogno di nulla
3° Per i file rar e zip la soluzione te l’ha data già wolly, prova ad inserire nel function.php del child theme questa funzione
function my_myme_types($mime_types){
$mime_types = array(
‘rar’ => ‘application/rar’,
‘zip’ => ‘application/zip’
);
return $mime_types;
}
add_filter(‘upload_mimes’, ‘my_myme_types’, 1, 1);
-
17 Settembre 2013 alle 8:57 #106250marleyPartecipante
1° I temi di default non si modificano mai ma si deve usare un child theme
2° I file pdf si possono caricare senza bisogno di nulla
3° Per i file rar e zip la soluzione te l’ha data già wolly, prova ad inserire nel function.php del child theme questa funzione
function my_myme_types($mime_types){
$mime_types = array(
‘rar’ => ‘application/rar’,
‘zip’ => ‘application/zip’
);
return $mime_types;
}
add_filter(‘upload_mimes’, ‘my_myme_types’, 1, 1);
Innanzitutto grazie elmanisero,
allora, utilizzo il child, ma non mi è chiara una cosa…
questo codice se lo copio cosଠcom’è all’interno del mio file functions.php del tema child non succede nulla…. ho provato con e senza <?php
l’ho chiamato function e functionS.php ma nulla…..
un’ultima cosa… se sblocco l’upload di zip e rar, non vado comunque incontro all’upload di virus? o inserendo questa funzione fa un controllo prima?
-
17 Settembre 2013 alle 9:14 #106251elmaniseroPartecipante
Io non l’ho provato e in rete ci sono parecchie discussioni a riguardo con codici diversi e modifiche anche al file .htaccess
Prova ad utilizzare questo plugin http://wordpress.org/plugins/media-features/
-
-
AutorePost
- Devi essere connesso per rispondere a questo topic.