Database Library and File uploading Library Questions

#1
[eluser]parham90[/eluser]
Hello there,
I've got two questions; one for each library! :-)

First of all, in the database library it is said that the values, when inserted using the active record method, are automatically escaped. I have inserted values into a table, and when I look at the table, I see nothing escaped... is it only for HTML tags and such?
Also, should I sanitize the data (make sure it is not going to mess with the query sent to the database), or it will be done automatically, too?

My second question is about the file uploading class, as promised! :-)
Imagine we have a file called image1.jpg in the upload folder. I go and upload a file with the same name, and since in the PHP script overwrite is false, it won't be overwritten. All fine up to this point. However, will the $this->upload->data() function return the file name in the uploader's computer (I.E. image1.jpg), or the renamed file name?

Thanks!

#2
[eluser]flaky[/eluser]
1. CI sanitizes your input data automatically
2. With $this->upload->data() you can get both, the original and renamed name of the file

#3
[eluser]parham90[/eluser]
Hi there,
Thanks a lot for the quick reply! So, what you are saying is that orig_name (if I remember correctly) shows the original name -- the one on the client's computer, and $this->upload->data('full_path') gives the path to the renamed file? Or is it different? I remember reading that orig_name is only useful for the times you are encrypting the file name.
Thanks!

#4
[eluser]flaky[/eluser]
Code:
orig_name
gives you the original (initial) name of the file (before it gets renamed.
use
Code:
file_name
to get the renamed version of the name (if it has been renamed)

Code:
full_path
gives the full path including the file name, in the server (with the renamed name)

#5
[eluser]parham90[/eluser]
Thank you! All fixed. :-)


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.