0

My problem is why this codes dont work. i want to upload image with hide input type file but doesnt work. here are my codes..

<form action="" method="post" enctype="multipart/form-data">
    <div id ="settingmaincontainerright">
        <input  type="file" id="settingprofileimgfile" name ="settingprofileimgfile" >
        <input  type="submit" id="settingprofileimgfilebutton"  name="settingprofileimgfile" value="Choose Foto">
        <input  type="submit" id="settingprofileimgbutton"  name="settingprofileimg" value="Upload Foto">
    </div>
</form>

This is css.

#settingprofileimgfile{
    width:100%;
    height:100px;
    display:none;
}
#settingprofileimgfilebutton{
    width:100%;
    height:100px;
    border-top-right-radius: 30px;
    cursor:pointer;
}
#settingprofileimgbutton{
    width:100%;
    height:100px;
    border-bottom-right-radius: 30px;
    cursor:pointer;
}
#settingmaincontainer{
  width:90%;
  margin:auto;
  border:3px solid #FF4500;
  border-radius:30px;
  height :200px;
  margin-top:10px;
}

Here is JS..

$(function(){
    $("#settingprofileimgfilebutton").click(function() {
    $("#settingprofileimgfile").click();
});
});

Edited by phoenix254

3
Contributors
8
Replies
18
Views
2 Years
Discussion Span
Last Post by JorgeM
0

. i want to upload image with hide input type file but doesnt work

please clarify what you are trying to do. I dont understand the logic/worklow

0

I want to upload an image to my dirctory with php and but this code doesnt work. when i click on upload foto button, nothing happen.

0

I dont see any PHP code and your form action attribute is blank. You need to include the name of the php page that will handle the processing of your form submission.

Example...

<form action="fileUpload.php" method="post" enctype="multipart/form-data">

Then on the PHP page, extract the data that was included in the post and process accordingly.

1

"Foto" in spanish, italian, catalan, etc.. means Photo. The OP refers to image therefore, the assumption is that we are talking about uploading a picture.

it could be a picture of goat cheese though.

0

Ok you will need image recognition software then in case someone tries to inject some brie or red leicester by mistake.

0

i have php code on same page.

<form action="" method="post" enctype="multipart/form-data">
  <div id ="settingmaincontainerright">
   <input  type="file" id="settingprofileimgfile" name ="settingprofileimgfile" >
   <input  type="submit" id="settingprofileimgbutton"  name="settingprofileimg" value="Upload Foto">
   </div>
</form>

when i try with html code, its work. but i dont want to shwo this input file <input type="file" id="settingprofileimgfile" name ="settingprofileimgfile" >

0

i not sure what you are tyring to do by hidding it, but if the problem is related to display: none, then try setting the position to "relative", then move it off of screen by using "left: -99999px".

Edited by JorgeM

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.