CodeIgniter Forums
File Uploading .ZIP .RAR - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter Archived (from EllisLab) (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: File Uploading .ZIP .RAR (/thread-49420.html)

Pages: 1 2


File Uploading .ZIP .RAR - El Forum - 02-18-2012

[eluser]kr1pt[/eluser]
How to hack core library to allow .zip and .rar uploading?

I used search but there are only <2.0.0 results...


File Uploading .ZIP .RAR - El Forum - 02-18-2012

[eluser]jmadsen[/eluser]
Assuming you mean the file uploading class?

1) library hasn't changed that I'm aware of, so older results should work

2) no idea why you need to "hack the core library":

$config['allowed_types'] = 'gif|jpg|png';

http://ellislab.com/codeigniter/user-guide/libraries/file_uploading.html

should do what you are after.

perhaps you should explain your problem a little more?


File Uploading .ZIP .RAR - El Forum - 02-18-2012

[eluser]kr1pt[/eluser]
[quote author="jmadsen" date="1329608694"]Assuming you mean the file uploading class?

1) library hasn't changed that I'm aware of, so older results should work

2) no idea why you need to "hack the core library":

$config['allowed_types'] = 'gif|jpg|png';

http://ellislab.com/codeigniter/user-guide/libraries/file_uploading.html

should do what you are after.

perhaps you should explain your problem a little more?[/quote]

Yes, i know that, lol, but i cant upload .zip and .rar files... even with mimes entered...


File Uploading .ZIP .RAR - El Forum - 02-18-2012

[eluser]jmadsen[/eluser]
then you probably want to do some error handling and let us know what's going on.

you're a programmer, right? you know how to set that up?


File Uploading .ZIP .RAR - El Forum - 02-19-2012

[eluser]kr1pt[/eluser]
[quote author="jmadsen" date="1329611945"]then you probably want to do some error handling and let us know what's going on.

you're a programmer, right? you know how to set that up?[/quote]

well, lot of people here know whats going on, but for your sake, whenever i upload .zip or .rar file, i get "invalid filetype". $config['allowed_types'] = 'zip|rar', and mimes have rar and zip arrays...


File Uploading .ZIP .RAR - El Forum - 02-19-2012

[eluser]InsiteFX[/eluser]
Quote:How to hack core library to allow .zip and .rar uploading?

You do not hack core files! You extend them...

Code:
Detailed information for file extension ZIP:

--------------------------------------------------------------------------------

Primary association: Compressed Archive File

File classification: Archive

Mime type:
application/zip,
application/x-zip,
application/x-zip-compressed,
application/octet-stream,
application/x-compress,
application/x-compressed,
multipart/x-zip

Identifying characters Hex: 50 4B 03 04 , ASCII: PK
Related links: Pack/Unpack with 7-Zip


"application/x-rar rar" in mime.types or "AddType application/x-rar .rar" in httpd.conf.

'application/zip',
'application/rar',
'application/x-zip-compressed',
'multipart/x-zip',
'application/x-compressed',
'application/octet-stream',
'application/x-rar-compressed',
'compressed/rar',
'application/x-rar'



File Uploading .ZIP .RAR - El Forum - 02-20-2012

[eluser]jmadsen[/eluser]
[quote author="kr1pt" date="1329671414"][quote author="jmadsen" date="1329611945"]then you probably want to do some error handling and let us know what's going on.

you're a programmer, right? you know how to set that up?[/quote]

well, lot of people here know whats going on, but for your sake, whenever i upload .zip or .rar file, I get "invalid filetype". $config['allowed_types'] = 'zip|rar', and mimes have rar and zip arrays...[/quote]

you see, that last time someone came on complaining that a certain file type wouldn't work for them, we did this long "please post your code & error messages" bit while they kept insisting over and over that it was "completely obvious" what the problem was...so after a few rounds of that, they finally posted the error message:

"The uploaded file exceeds the maximum allowed size in your PHP configuration file."

So, if you want to come to this community & ask people to take time out of their busy schedules to give you personal, one-on-one help:

-- post your code
-- post your error message

because we have no way to know if you are another Rasmus Lerdorf with a genuine bug, or are just another dumbshit who needs his hand held.



File Uploading .ZIP .RAR - El Forum - 02-20-2012

[eluser]kr1pt[/eluser]
[quote author="InsiteFX" date="1329688858"]
Quote:How to hack core library to allow .zip and .rar uploading?

You do not hack core files! You extend them...

Code:
Detailed information for file extension ZIP:

--------------------------------------------------------------------------------

Primary association: Compressed Archive File

File classification: Archive

Mime type: application/zip, application/x-zip, application/x-zip-compressed, application/octet-stream, application/x-compress, application/x-compressed, multipart/x-zip
Identifying characters Hex: 50 4B 03 04 , ASCII: PK
Related links: Pack/Unpack with 7-Zip


"application/x-rar rar" in mime.types or "AddType application/x-rar .rar" in httpd.conf.

'application/zip',
'application/rar',
'application/x-zip-compressed',
'multipart/x-zip',
'application/x-compressed',
'application/octet-stream',
'application/x-rar-compressed',
'compressed/rar',
'application/x-rar'
[/quote]

Thanks a lot, it works now.


File Uploading .ZIP .RAR - El Forum - 03-07-2012

[eluser]GabeHarris[/eluser]
Need similar help, I'm trying to upload a zip file, throws upload error "The filetype you are attempting to upload is not allowed." Latest version of CI. Here is the config for the upload:
Code:
$up_config['upload_path'] = './assets/img/uploads/';
  $up_config['allowed_types'] = 'zip|txt|application/zip|text/plain';
  $this->load->library('upload',$up_config);

And here is my upload file data:
Code:
Array ( [file_name] => country_road.zip [file_type] => text/plain [file_path] => public_html/mhphoto/assets/img/uploads/ [full_path] => public_html/mhphoto/assets/img/uploads/country_road.zip [raw_name] => country_road [orig_name] => [client_name] => country_road.zip [file_ext] => .zip [file_size] => 403888 [is_image] => [image_width] => [image_height] => [image_type] => [image_size_str] => )

And for good measure this is what I have in my mimes.php
Code:
'zip' =>  array('application/x-zip', 'application/zip', 'application/x-zip-compressed','multipart/x-zip','application/x-compressed'),

Here's the most confusing part - I built the site in a dev environment (on a subdomain of the production site) and I'm using the same code files, and it works in the dev environment. Is there an Apache setting somewhere I am missing maybe (I'm not a good server configuration guy at all)? Hosted at HostMonster.com, if that matters.

Thanks for any help!



File Uploading .ZIP .RAR - El Forum - 03-07-2012

[eluser]InsiteFX[/eluser]
mimes.php
Code:
'zip' =>  array('application/zip', 'application/x-zip', 'application/x-zip-compressed', 'application/octet-stream', 'application/x-compress', 'application/x-compressed', 'multipart/x-zip'),

'rar' => ('application/rar', 'application/x-rar', 'application/x-rar-compressed', 'application/x-compressed', 'application/octet-stream'),

Code:
$up_config['upload_path']   = './assets/img/uploads/';
$up_config['allowed_types'] = 'zip|rar|txt';

$this->load->library('upload',$up_config);

upload file data:
Code:
Array ( [file_name] => country_road.zip
[file_type] => text/plain
[file_path] => public_html/mhphoto/assets/img/uploads/
[full_path] => public_html/mhphoto/assets/img/uploads/country_road.zip
[raw_name] => country_road
[orig_name] =>
[client_name] => country_road.zip
[file_ext] => .zip
[file_size] => 403888
[is_image] =>
[image_width] =>
[image_height] =>
[image_type] =>
[image_size_str] => )

You may also need to download the 3.0 Dev which I belive has fixed the upload problems...