JavaScript
--
Questions
--
Followers
Top Experts
C:\fakepath\imagename.jpg
I want to remove the C:\fakepath\ from there. ย I don't know javascript so was hoping it was an easy fix in my below code that's used.
// <![CDATA[
$(document).ready(function () {
$('input[type=file]').each(function () {
var label = 'Browse';
var button = '<input type="button" class="button-alt" value="' + label + '" />';
$(this).wrap('<div class="fileinput"></div>');
$(this).addClass('file').css('opacity', 0); //set to invisible
$(this).parent().append($('<div class="filemask" />').append($('<input type="text" class="inputbox-sml" size="40" style="margin-right:10px"/>').attr('id', $(this).attr('id') + '__fake')).append(button));
$(this).bind('change', function () {
$('#' + $(this).attr('id') + '__fake').val($(this).val());;
});
$(this).bind('mouseout', function () {
$('#' + $(this).attr('id') + '__fake').val($(this).val());;
});
});
});
// ]]>
Zero AI Policy
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
function basename(path) {
return path.replace(/\\/g,'/').replace( /.*\//, '' );
}
which I ruthlessly stole from http://planetozh.com/blog/2008/04/javascript-basename-and-dirname/
<?php
/**
* Account Profile
*
* @package Advanced Login System
* @author wojoscripts.com
* @copyright 2010
* @version $Id: account.php, v2.00 2011-07-10 10:12:05 gewa Exp $
*/
$row = $user->getUserData();
?>
<?php include("headerfront.php");?>
<p class="info">Here you can make changes to your profile...</p>
<div class="box1" style="width:610px;">
<form action="" method="post" id="admin_form" name="admin_form" enctype="multipart/form-data">
<table width="100%" border="0" cellpadding="3" cellspacing="0" class="display">
<thead>
<tr>
<th colspan="2" class="left">Edit Your Account</th>
</tr>
</thead>
<tr>
<th width="180"><strong>Username:</strong></th>
<td><input name="username" type="text" disabled="disabled" class="inputbox" value="<?php echo $row['username'];?>" size="45" /></td>
</tr>
<tr>
<th><strong>Password:</strong></th>
<td><input name="password" type="password" class="inputbox" size="45" />
<?php echo tooltip('Leave it empty unless changing the password');?></td>
</tr>
<tr>
<th><strong>Email Address: <?php echo required();?></strong></th>
<td><input name="email" type="text" class="inputbox" value="<?php echo $row['email'];?>" size="45" maxlength="40" /></td>
</tr>
<tr>
<th><strong>First Name:</strong> <?php echo required();?></th>
<td><input name="fname" type="text" class="inputbox" value="<?php echo $row['fname'];?>" size="45" /></td>
</tr>
<tr>
<th><strong>Last Name:</strong> <?php echo required();?></th>
<td><input name="lname" type="text" class="inputbox" value="<?php echo $row['lname'];?>" size="45" /></td>
</tr>
<tr>
<th><strong>Avatar:</strong></th>
<td><input name="avatar" id="imgfile" type="file" size="40" class="inputbox" /></br> <?php echo ($row['avatar']) ? '<img src="'.UPLOADURL . $row['avatar'].'" alt=""/>' : '<img src="'.UPLOADURL.'blank.png" alt=""/>';?></td>
</tr>
<tr>
<th><strong>Date Registered:</strong></th>
<td><span class="input-out"><?php echo $row['cdate'];?></span></td>
</tr>
<tr>
<th><strong>Last Login:</strong></th>
<td><span class="input-out"><?php echo $row['ldate'];?></span></td>
</tr>
<tr>
<td colspan="2"><input name="doupdate" type="submit" value="Update Profile" class="button"/></td>
</tr>
</table>
</form>
</div>
</div>
<script type="text/javascript">
// <![CDATA[
$(document).ready(function () {
$('input[type=file]').each(function () {
var label = 'Browse';
var button = '<input type="button" class="button-alt" value="' + label + '" />';
$(this).wrap('<div class="fileinput"></div>');
$(this).addClass('file').css('opacity', 0); //set to invisible
$(this).parent().append($('<div class="filemask" />').append($('<input type="text" class="inputbox-sml" size="40" style="margin-right:10px"/>').attr('id', $(this).attr('id') + '__fake')).append(button));
$(this).bind('change', function () {
$('#' + $(this).attr('id') + '__fake').val($(this).val());;
});
$(this).bind('mouseout', function () {
$('#' + $(this).attr('id') + '__fake').val($(this).val());;
});
});
});
// ]]>
</script>
<?php echo $core->doForm("processUser","ajax/controller.php");?>
</html>






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
http://s10.postimg.org/6rvak1195/image.png
Then you hit update profile and it uploads and saves the new avatar.
I want to just hide the C:\fakepath\.

Get a FREE t-shirt when you ask your first question.
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
Here is the modified code.
// <![CDATA[
$(document).ready(function () {
$('input[type=file]').each(function () {
var label = 'Browse';
var button = '<input type="button" class="button-alt" value="' + label + '" />';
$(this).wrap('<div class="fileinput"></div>');
$(this).addClass('file').css('opacity', 0); //set to invisible
$(this).parent().append($('<div class="filemask" />').append($('<input type="text" class="inputbox-sml" size="40" style="margin-right:10px"/>').append(button));
$(this).bind('change', function () {
$('#' + $(this).attr('id') + '__fake').val($(this).val());;
});
$(this).bind('mouseout', function () {
$('#' + $(this).attr('id') + '__fake').val($(this).val());;
});
});
});
// ]]>
Do the change and mouseout bindings still work?






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
JavaScript
--
Questions
--
Followers
Top Experts
JavaScript is a dynamic, object-based language commonly used for client-side scripting in web browsers. Recently, server side JavaScript frameworks have also emerged. JavaScript runs on nearly every operating system and in almost every mainstream web browser.