CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 File Upload Component problem

Print topic Send  topic

Author Message
mdevane

Posts: 1
Posted: 06/10/2004, 2:56 PM

Trying out CCS for the first time, and am having weird problems with File Upload component as follows:

1. no matter what url I use in the File Folder property of the control, the only data inserted into the database is the bare filename only, no url info. It appears the 2 grids/forms (Employee Add $ File Upload) are not talking to each other properly.

2. When I try deleting a file which has been uploaded and its link inserted into the associated record, the entire record (e.g.- employee) gets deleted also.

3. When I upload a file into a newly created record (employee), it inserts the file location into the db (stripped of the url info) and deletes the other fields in the record.

This program appears to have potential, but there are too many odd issues for me to feel comfortable in a production environment.

Any suggestions as to what might be causing these anomolies? Is there custom code required to do the basics here? Where would I go for help?

Regards, Mark
View profile  Send private message
peterr


Posts: 5971
Posted: 06/10/2004, 3:32 PM

Hi,

Re: 1
This is correct behavior that allows more flexibility. It is not possible to upload a file into a URL but into a path. The path can be relative or absolute and doesn't need to reflect the URL. Therefore you have the flexibility of adding the path or URL via custom code during the upload, or prefixing the file names with the URL when displaying the filename later. Other solutions would be too limiting and would be forcing everyone to use paths or URLs, which are not always equivalent and not always needed.
For example your FilePath could be "../files" but the URL could be "http://www.website.com/files/filename" or even just "filename" if you later want to display that file on a page that is already located somewhere at "http://www.website.com/files/". You could even display the same file on a page "www.website.com/page.php" and "www.website.com/files/page.php" and each time the relative file URL would be different (although the absolute URL would be the same).

Re: 2
This is correct behavior as well. There is no functionality to delete files (or one field in a record), but to delete the whole record. If you only display one field in the form (the file name) it doesn't mean that only that field should be deleted.
Instead you could add a "Delete" checkbox like at http://forums.codecharge.com/profile.php and write custom code to delete the file.
Actually, if you wanted to delete any field in a record then usually you would display that record and allow users to clear/delete the field value then press "Update", rather then "Delete".

Re: 3
This could be a real issue, although I didn't understand it completely. You wrote that the fields are deleted when creating anew record, but by default new records do not have any existing fields therefore nothing can be deleted. I'm assuming that you rather meant that all fields are being cleared and aren't updated together with the fielname? If so, you may want to contact our support at http://support.codecharge.com and they could take a look at your sample page.
Actually the support would be best to contact for any type of help, as we do cannot guranatee responses via user forums.
There are many helpful users here too though :-)
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
Mark
Posted: 06/10/2004, 5:48 PM

Hi Peterr - thx for the fast response. I was probably not detailed enough in my initial post but I will expand. Regarding:

#1. Here's my expectation regarding the component. I want to be able to upload photos to be inserted into a soccer team player database --based on your response above, what is the simplest way to add the file with the correct pathname to the appropriate db column, without having to program this task? While I appreciate the flexibility, achieving a basic requirement like this should not require programming. The properties imply that it is not only possible, but is designed to perform this function non-programatically. The value of a tool like CCS is to minimize/avoid programming where possible. Perhaps I misunderstand your response (very possible :-)), but it seems to me that to program the last 5-10% of the File Upload component defeats the purpose.

2. I am referring to the delete button associated with the File Upload component -- are you saying that its intent is to delete the entire db record associated with the uploaded file? Seems counter-intuitive -- most people would assume to delete only the uploaded file.

3. I will try to recreate this one and submit to Tech Support.

To be fair, much of my frustration (I'm sure) is due to my learning curve - I think CCS has great potential. Great product!

Regards, Mark
peterr


Posts: 5971
Posted: 06/10/2004, 7:28 PM

Mark,

With regard to #1, the File Upload works without any coding and often is sufficient for Web applications without the full path. This is 100% of the functionality and you don't need to program anything. For example I don't need the full path so what should I do with the software that puts it there? :-)
We can't simply assume that everyone needs this. I actually don't know why you would want to save the full path, or why not relative path, or why not full URL, or why not relative URL, so even if this was automated it probably wouldn't save the "thing" that you need in your scenario.
The filename itself works OK in many situations and possibly I don't know why it's not sufficient for you, but this shows that you have a custom request and therefore should use custom code.
Furthermore, the custom code in events is the feature of CCS and there is nothing wrong with using it. We've implemented run-time properties that should be modified programmatically and this is what they are for. Usually it's not a big deal to add one line of code and it offers more control.
In comparison, what's the point of buying a professional digital camera if all settings were automatic and you couldn't set anything manually? :-)

With regard to #2, I'm not aware of a Delete button associated with the File Upload. Do you mean the chekcbox? The "Delete" checkbox should not delete the whole record but the "Delete" button for the record should. If there are any problems with it, again our support should help.

Regards,
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
Mark
Posted: 06/11/2004, 8:41 AM

Peterr - I am not clear. With regard to #1:

File Upload is not working as advertised and per your comments above. When the file gets uploaded, the file link is added to the db without regard to the actual pathname. Therefore when the app tries to display the image, nothing displays because the app cannot locate the file it "believes" to be in root (since there is no associated pathname).

On the other hand, the File Upload component can see the file and can delete the file (as well as the entire associated record). Hence my comment that the two linked components are not communicating properly.

I have changed the pathname in the property box to: full path, relative path, full url, and relative url, and none are saved to db, therefore the record displays nothing. If I manually modifiy the db record to include the correct pathname, then the record component displays the file image properly, but the File Upload component can no longer find it, and displays an error message.

Again, I'm not saying that the product is broken, but I cannot seem to find any property other than the one above which manages that linkage.

With regard to #2, when I add a File Upload component to a new page, there are two (2) Delete functions added to the form. The first is a checkbox (which you mention above. The second is a button labeled "Delete" which I presume to be associated with the checkbox in the form. This is not the Delete button on the Record form. When you check the Delete checkbox and press Delete button, I assume the image file would be deleted. Instead it deletes both the image file and the associated Employee record.

This is most likely user error :-), but I have looked at all tutorials, user manuals, reference guides, etc. and cannot seem to identify the culprit. Last night, I decided to un-associate the File Upload form from the Record form (both on same page), and when I hit the File Upload delete button, it deleted not the image file, but rather the entire employee test database -- I am not kidding you :-O

Any suggestions would be greatly appreciated at this point. There is no custom coding in this page -- just straight functionality out of box.

Mark
peterr


Posts: 5971
Posted: 06/11/2004, 9:50 AM

Mark,

#1 again:
Your images could not be displayed at all if you saved the full file path in the database. For example the Web browser cannot display an image that has the path "\usr\lib\apache\website\images\image.gif" because the Web browser doesn't have access to the server's file structure and cannot read files using full file path.
And actually my "File Folder" property is exactly "\usr\lib\apache\website\images". If this path was saved together with the file name then I gurantee 100% that the Web browser could not display the files with names like "\usr\lib\apache\website\images\image.gif". This simply won't work.

Please view HTML source of this page (here in the Forums) and search for ".gif". You will find images with paths like "images/header_cc_logo.gif". The
images/" is not the file path because I would upload the files to this path "\usr\lib\apache\website\images".
Furthermore, the exact same images that you can see in HTML source as "images/header_cc_logo.gif", are shown on other pages as "../images/header_cc_logo.gif". Therefore the path is actually different on different pages where the same file is being shown, but the File Upload has only one path! Thus in our situation we're using a different path based on which page displays it, not based on the File Path during the Upload.
Yes, you could specify some exact image URL during the upload but this doesn't mean that everyone should be forced to do this, therefore you can use events to do this optionally.
In any case, the File Upload was created for uploading files, not for displaying them. It works because the file is uploaded. You now wrote that you have a problem with displaying those files, not with uploading them. Therefore if the question is "How to display the uploaded images?" then the answer would be that you can add the URL prefix to the HTML of the page that displays those files. For example change:
<img src="{picture}"> to <img src="images/{picture}">
(this is not more difficult than setting some additional properties)
You could also use an event when displaying the file but I hope that the above will take care of what you need.

As for #2, I think that the "Delete" button is probably not added when you add a File Upload component but when you create the form itself. Thus if instead of using File Upload component, you would include any other field (for example TextBox) then the "Delete" button would also be created. The "Delete" button is basically used with any Record form, regardless of the File Upload. The File Upload is just a form-type control like many others, but it adds the "Delete" checkbox because it deals with files. If you like to add some clarity simply rename the "Delete" button to "Delete Record" within the HTML.

Hope this helps.

_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.