Jump to content

adding value to input file


aram

Recommended Posts

Hi i have this code for adding an input file a value with php but when its executes its null, why?

<input type="file" name="image_name" size="40" value="<?php echo $rows['image']; ?>">

Link to comment
Share on other sites

I am not sure. what are you expecting from this to do?

Link to comment
Share on other sites

I am not sure. what are you expecting from this to do?
I want to add a value to this input file from mysql, This (echo $rows['image']:) should get data from mysql.Is that possible to add values to input file like adding values to text because i have this code works fine with no problem
<input type="text" name="title"  value="<?php echo $rows['title']; ?>">

There is no different but the first one gets nothing from database and the second one has no problem

Link to comment
Share on other sites

there is no problem with text type attribute it will print the value. file type attribute is used to send files. Why you need to add value of $row['image'] in that? i guess $row['image'] will return nothing but a binary image file?

Link to comment
Share on other sites

there is no problem with text type attribute it will print the value. file type attribute is used to send files. Why you need to add value of $row['image'] in that? i guess $row['image'] will return nothing but a binary image file?
I have cms for news page, in this cms i have a page for adding a news with title and image to the database, and i have another page for editing the news. i want in this editing page the input file get this image that was added in add page, so i want this to not let duplicate files or for making easy way for the editor for editing the news an not upload the file every time he/she edits the news.thanks for listening
Link to comment
Share on other sites

If you dont want to upload the file again why you need to add this? you can simply accomodate place for only title/news which will be edited after form submission and remove the <input type='file'....

Link to comment
Share on other sites

If you dont want to upload the file again why you need to add this? you can simply accomodate place for only title/news which will be edited after form submission and remove the <input type='file'....
no i need this too because some times i change only the image or in revrse some times i only change the title or the news
Link to comment
Share on other sites

then make your image upload part optional. means if user does not submit any file dont execute the upload part if they submit a file execute upload part. same you can done with other field if user does not give any input dont update the text to database else update it.

Link to comment
Share on other sites

then make your image upload part optional. means if user does not submit any file dont execute the upload part if they submit a file execute upload part. same you can done with other field if user does not give any input dont update the text to database else update it.
its to much codes for this you are saying but if there is something to adding value in the input file its much better i think,I think my idea to adding value to the input file is so good for my position but how to do it i dont know??????????????????
Link to comment
Share on other sites

You should have write the minimal amount of code to run the script efficently if the script need that. Did you think about that if you echo the image in it everytime it will be also loaded into the page and will increase the file size. regardless of user using it or not and then again re uploading it. What is you saying is quite unfamiliar way of i am not sure about it. but i dont think it will be the best choice to do that.

Link to comment
Share on other sites

You should have write the minimal amount of code to run the script efficently if the script need that. Did you think about that if you echo the image in it everytime it will be also loaded into the page and will increase the file size. regardless of user using it or not and then again re uploading it. What is you saying is quite unfamiliar way of i am not sure about it. but i dont think it will be the best choice to do that.
Yes you are right i didnt think about it, i will think about you solution
Link to comment
Share on other sites

In joomla CMS, you add article images to a specific folder 'stories', within that you can add subfolders, and add images to those, if the user has authorization, the user can edit from the front end, and access these, or upload new images, and then add these to the article, or just edit the article itself. The user can be assigned about four different user authorization level from the backend user manager, which controls what the user can do, when it comes to editing any articles.I would have thought the other cms would work on a similar setup.

Link to comment
Share on other sites

In joomla CMS, you add article images to a specific folder 'stories', within that you can add subfolders, and add images to those, if the user has authorization, the user can edit from the front end, and access these, or upload new images, and then add these to the article, or just edit the article itself. The user can be assigned about four different user authorization level from the backend user manager, which controls what the user can do, when it comes to editing any articles.I would have thought the other cms would work on a similar setup.
yes i want somethink like this
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...