rado
Posts: 221
|
| Posted: 10/30/2008, 11:17 AM |
|
I have the page where is the filed "path to Picture". I'm looking for way to create button "Browse" so I can drill-down to location where is the picture and insert the relative path into the filed. Any idea how can I do that? I'm working with PHP and MySQL.
Thanks for any kind of help!
Rado
|
 |
 |
melvyn
Posts: 333
|
| Posted: 10/30/2008, 11:46 AM |
|
Go to: Toolbox -> Forms -> File Upload
It inserts a file upload component, with a "Browse" button. Drag to your form and set the parameters. There are 3 parameters which you must set carefully:
1) Control Source: the field in database
2) temporary folder: any temp folder
3) file folder: where picture will be located
Click there, it's easy, because CCS will do almost all for you, including the "Browse" button.
_________________
Melvyn Perez
Puro Codigo
http://purocodigo.com |
 |
 |
rado
Posts: 221
|
| Posted: 10/30/2008, 11:54 AM |
|
Thanks Melvyn,
I have to ask one more thing. I'm currently running everything on my local machine. If I insert the path from, for example "Codecharge\Projects\project1\images" which is located on my machine, when I upload the project, to real web server, do I have to change the path or path will be still valid?
Rado
|
 |
 |
melvyn
Posts: 333
|
| Posted: 10/30/2008, 12:02 PM |
|
wait, wait!!!!!!
if you insert the path as absolute, you'll need to change. I mean if you insert "C:\Users\rado\Documents\Codecharge\Projects\project1\images". Don't do that.
if you're working on "C:\Users\rado\Documents\Codecharge\Projects\project1" and your images folder is "C:\Users\rado\Documents\Codecharge\Projects\project1\images" then you only need to set File Folder content as "images" (no quotes).
Your "images" folder is in the site root, so you need to create it in your local and your production server, only 'images' no slash, no quotes, nothing more. If you have a folder structure may work too, I currently have open a page with ../../images/properties and works in both. Try and let us know.
_________________
Melvyn Perez
Puro Codigo
http://purocodigo.com |
 |
 |
rado
Posts: 221
|
| Posted: 10/30/2008, 12:08 PM |
|
In that case, maybe I even don't need "Browse" button since my picture will be located in for example "images\pic1.jpg".It's not big deal to type . Is that correct?
Thanks for help
|
 |
 |
melvyn
Posts: 333
|
| Posted: 10/30/2008, 12:12 PM |
|
Quote rado:
In that case, maybe I even don't need "Browse" button since my picture will be located in for example "images\pic1.jpg".It's not big deal to type . Is that correct?
For me it's not a big deal, for my users it's a very big deal. When I'm developing I only insert sample data, and I know what I'm doing and from where I'm taking content. The user... well, the user don't know a s***t. I don't know what type of project is yours, let's take one mine: real estate. 10 pictures for an apartment on sale. Brose button is a very big deal because the user uploading all those files don't know everything and users like the mouse.
_________________
Melvyn Perez
Puro Codigo
http://purocodigo.com |
 |
 |
rado
Posts: 221
|
| Posted: 10/30/2008, 12:28 PM |
|
You are right.
The page that I'm trying to make is kind of your's (realestate). I have field "pic_url" that I have to populate into database. Now If I use file upload the path that will be stored is c:\something\blabla\pic.jpg, which is not good. I have to somehow upload image to \myproject\images directory and insert the path to location from project. Not idea what to do?
|
 |
 |
melvyn
Posts: 333
|
| Posted: 10/30/2008, 1:14 PM |
|
Wait!
Only store the image's filename in the database. You don't need the path. Only filename.
When you need to call the image in some script, append the path before the imagen name
This is your html's code:
<img src="{pic_url}" >
Change to:
<img src="images/{pic_url}" >
The above change is something you do by hand in the html view, not php code, neither an event. Also you can change it in the component's properties.
Try it.
_________________
Melvyn Perez
Puro Codigo
http://purocodigo.com |
 |
 |
rado
Posts: 221
|
| Posted: 10/30/2008, 1:26 PM |
|
Thank you . You are really the Maaaaan.
Rado
|
 |
 |
mamboBROWN
Posts: 1713
|
| Posted: 10/31/2008, 5:35 AM |
|
rado
If your issue has been resolved could you please put [RESOLVED] or [SOLVED] in the header of this thread. Thanks.
|
 |
 |
|